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 [17/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/SimpleSelectOneRenderer.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/SimpleSelectOneRenderer.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/SimpleSelectOneRenderer.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleSelectOneRenderer.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,34 +27,33 @@
import javax.faces.context.ResponseWriter;
import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;
-
import javax.faces.model.SelectItem;
import javax.faces.model.SelectItemGroup;
-import org.apache.myfaces.trinidad.logging.TrinidadLogger;
-
import org.apache.myfaces.trinidad.bean.FacesBean;
import org.apache.myfaces.trinidad.bean.PropertyKey;
-
import org.apache.myfaces.trinidad.component.UIXSelectOne;
-
-import org.apache.myfaces.trinidadinternal.agent.TrinidadAgent;
import org.apache.myfaces.trinidad.context.FormData;
import org.apache.myfaces.trinidad.context.RenderingContext;
-import org.apache.myfaces.trinidadinternal.renderkit.uix.SelectItemSupport;
+import org.apache.myfaces.trinidad.logging.TrinidadLogger;
import org.apache.myfaces.trinidad.util.IntegerUtils;
+import org.apache.myfaces.trinidadinternal.agent.TrinidadAgent;
+import org.apache.myfaces.trinidadinternal.renderkit.uix.SelectItemSupport;
+
/**
*/
abstract public class SimpleSelectOneRenderer extends FormInputRenderer
{
- public SimpleSelectOneRenderer(FacesBean.Type type)
+ public SimpleSelectOneRenderer(
+ FacesBean.Type type)
{
super(type);
}
@Override
- protected void findTypeConstants(FacesBean.Type type)
+ protected void findTypeConstants(
+ FacesBean.Type type)
{
super.findTypeConstants(type);
_valuePassThruKey = type.findKey("valuePassThru");
@@ -69,7 +68,7 @@
Object submittedValue = super.getSubmittedValue(context,
component,
clientId);
- boolean valuePassThru = getValuePassThru(getFacesBean(component));
+ boolean valuePassThru = getValuePassThru(component, getFacesBean(component));
if (submittedValue == null && valuePassThru)
submittedValue = "";
@@ -110,21 +109,22 @@
* @todo Move to utility class?
*/
static public boolean encodeOption(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- SelectItem item,
- Converter converter,
- boolean valuePassThru,
- int index,
- boolean isSelected) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ SelectItem item,
+ Converter converter,
+ boolean valuePassThru,
+ int index,
+ boolean isSelected
+ ) throws IOException
{
if (item == null)
return false;
if (item.isDisabled())
{
- if (!Boolean.TRUE.equals(arc.getAgent().getCapabilities().get(
+ if (!Boolean.TRUE.equals(rc.getAgent().getCapabilities().get(
TrinidadAgent.CAP_SUPPORTS_DISABLED_OPTIONS)))
return false;
}
@@ -172,9 +172,10 @@
public Object getConvertedValue(
FacesContext context,
UIComponent component,
- Object submittedValue) throws ConverterException
+ Object submittedValue
+ ) throws ConverterException
{
- boolean valuePassThru = getValuePassThru(getFacesBean(component));
+ boolean valuePassThru = getValuePassThru(component, getFacesBean(component));
if (!valuePassThru)
{
@@ -186,7 +187,6 @@
}
}
-
/**
* Call this method only when the valuePassThru attribute on the selectOne
* component is not set to true.
@@ -202,15 +202,16 @@
private Object _convertIndexedSubmittedValue(
FacesContext context,
UIComponent component,
- Object submittedValue) throws ConverterException
+ Object submittedValue
+ ) throws ConverterException
{
FacesBean bean = getFacesBean(component);
- Converter converter = getConverter(bean);
+ Converter converter = getConverter(component, bean);
if ( converter == null)
- converter = getDefaultConverter(context, bean);
+ converter = getDefaultConverter(context, component, bean);
List<SelectItem> selectItems = getSelectItems(component, converter, true);
-
+
int index = __getIndex(submittedValue, selectItems);
if (index < 0)
return null;
@@ -231,7 +232,6 @@
}
}
-
//
// ENCODE BEHAVIOR
//
@@ -239,35 +239,36 @@
*/
@Override
protected void encodeAllAsElement(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- FacesBean bean) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean
+ ) throws IOException
{
- Converter converter = getConverter(bean);
+ Converter converter = getConverter(component, bean);
if ( converter == null)
- converter = getDefaultConverter(context, bean);
- boolean valuePassThru = getValuePassThru(bean);
+ converter = getDefaultConverter(context, component, bean);
+ boolean valuePassThru = getValuePassThru(component, bean);
- if (isAutoSubmit(bean))
- AutoSubmitUtils.writeDependencies(context, arc);
+ if (isAutoSubmit(component, bean))
+ AutoSubmitUtils.writeDependencies(context, rc);
// Only add in validators and converters when we're in valuePassThru
// mode; otherwise, there's not enough on the client to even consider
- FormData fData = arc.getFormData();
+ FormData fData = rc.getFormData();
if (fData != null)
{
((CoreFormData) fData).addOnSubmitConverterValidators(component,
valuePassThru ? converter : null,
- valuePassThru ? getValidators(bean) : null,
+ valuePassThru ? getValidators(component, bean) : null,
getClientId(context, component),
- isImmediate(bean),
- getRequired(bean),
+ isImmediate(component, bean),
+ getRequired(component, bean),
getRequiredMessageKey());
}
List<SelectItem> selectItems = getSelectItems(component, converter, false);
-
+
int selectedIndex = _getSelectedIndex(context,
component,
bean,
@@ -276,17 +277,17 @@
valuePassThru);
ResponseWriter writer = context.getResponseWriter();
- boolean simple = getSimple(bean);
+ boolean simple = getSimple(component, bean);
if (simple)
{
writer.startElement("span", component);
// put the outer style class here, like af_selectOneRadio, styleClass,
// inlineStyle, 'state' styles like p_AFDisabled, etc.
- renderRootDomElementStyles(context, arc, component, bean);
+ renderRootDomElementStyles(context, rc, component, bean);
}
encodeElementContent(context,
- arc,
+ rc,
component,
bean,
selectItems,
@@ -296,8 +297,8 @@
- if (isHiddenLabelRequired(arc))
- renderShortDescAsHiddenLabel(context, arc, component, bean);
+ if (isHiddenLabelRequired(rc))
+ renderShortDescAsHiddenLabel(context, rc, component, bean);
if (simple)
{
@@ -305,40 +306,42 @@
}
}
- abstract protected void encodeElementContent(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- FacesBean bean,
- List<SelectItem> selectItems,
- int selectedIndex,
- Converter converter,
- boolean valuePassThru) throws IOException;
+ abstract protected void encodeElementContent(
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean,
+ List<SelectItem> selectItems,
+ int selectedIndex,
+ Converter converter,
+ boolean valuePassThru
+ ) throws IOException;
@Override
protected void renderNonElementContent(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- FacesBean bean) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean
+ ) throws IOException
{
// http://issues.apache.org/jira/browse/ADFFACES-151
// Getting default converter for null value leads to exception but
// if value of component is null than there is no need to perform
// this method
- if (getValue(bean) == null)
+ if (getValue(component, bean) == null)
return;
- Converter converter = getConverter(bean);
+ Converter converter = getConverter(component, bean);
if ( converter == null)
- converter = getDefaultConverter(context, bean);
- boolean valuePassThru = getValuePassThru(bean);
+ converter = getDefaultConverter(context, component, bean);
+ boolean valuePassThru = getValuePassThru(component, bean);
// =-=AEW If needed, this could be made more efficient
// by iterating through the list instead of getting
// all the items
List<SelectItem> selectItems = getSelectItems(component, converter, false);
-
+
int selectedIndex = _getSelectedIndex(context,
component,
bean,
@@ -355,7 +358,7 @@
}
else
{
- text = getUnselectedLabel(bean);
+ text = getUnselectedLabel(component, bean);
}
context.getResponseWriter().writeText(text, null);
@@ -369,20 +372,22 @@
protected List<SelectItem> getSelectItems(
UIComponent component,
- Converter converter)
+ Converter converter)
{
return getSelectItems(component, converter, false);
}
protected List<SelectItem> getSelectItems(
UIComponent component,
- Converter converter,
- boolean filteredItems)
+ Converter converter,
+ boolean filteredItems)
{
return SelectItemSupport.getSelectItems(component, converter, filteredItems);
}
- protected boolean getValuePassThru(FacesBean bean)
+ protected boolean getValuePassThru(
+ UIComponent component,
+ FacesBean bean)
{
Object o = bean.getProperty(_valuePassThruKey);
if (o == null)
@@ -394,7 +399,9 @@
/**
* @todo Move up to all SelectOnes?
*/
- protected String getUnselectedLabel(FacesBean bean)
+ protected String getUnselectedLabel(
+ UIComponent component,
+ FacesBean bean)
{
return null;
}
@@ -403,8 +410,8 @@
* Convert a stringified index into an index, with range-checking.
*/
static int __getIndex(
- Object submittedValue,
- List<SelectItem> selectItems)
+ Object submittedValue,
+ List<SelectItem> selectItems)
{
if ("".equals(submittedValue))
return -1;
@@ -432,7 +439,8 @@
}
}
- private static int countSelectItems(List<SelectItem> selectItems)
+ private static int countSelectItems(
+ List<SelectItem> selectItems)
{
int count = 0;
for(SelectItem item : selectItems)
@@ -443,7 +451,8 @@
return count;
}
- private static int calcItems(SelectItem item)
+ private static int calcItems(
+ SelectItem item)
{
if(item instanceof SelectItemGroup)
{
@@ -466,8 +475,8 @@
// Find the selected item in the list
//
private int _findIndex(
- Object value,
- List<SelectItem> selectItems)
+ Object value,
+ List<SelectItem> selectItems)
{
int size = selectItems.size();
int result;
@@ -487,7 +496,10 @@
return -1;
}
- private int resolveIndex(SelectItem item, Object value, int index)
+ private int resolveIndex(
+ SelectItem item,
+ Object value,
+ int index)
{
if(item instanceof SelectItemGroup)
{
@@ -522,25 +534,24 @@
}
protected String getAutoSubmitScript(
- RenderingContext arc,
- FacesBean bean)
- {
- String source = LabelAndMessageRenderer.__getCachedClientId(arc);
- boolean immediate = isImmediate(bean);
- return AutoSubmitUtils.getSubmitScript(arc, source, XhtmlConstants.AUTOSUBMIT_EVENT, immediate);
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean)
+ {
+ String source = LabelAndMessageRenderer.__getCachedClientId(rc);
+ boolean immediate = isImmediate(component, bean);
+ return AutoSubmitUtils.getSubmitScript(rc, source, XhtmlConstants.AUTOSUBMIT_EVENT, immediate);
}
-
-
private int _getSelectedIndex(
- FacesContext context,
- UIComponent component,
- FacesBean bean,
- List<SelectItem> selectItems,
- Converter converter,
- boolean valuePassThru)
+ FacesContext context,
+ UIComponent component,
+ FacesBean bean,
+ List<SelectItem> selectItems,
+ Converter converter,
+ boolean valuePassThru)
{
- Object submittedValue = getSubmittedValue(bean);
+ Object submittedValue = getSubmittedValue(component, bean);
// In passthru mode, if there's a submitted value, we just
// have to turn it into an int and range-check it
if ((submittedValue != null) && !valuePassThru)
@@ -553,7 +564,7 @@
Object value;
if (submittedValue == null)
{
- value = getValue(bean);
+ value = getValue(component, bean);
}
else
{
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SingleStepButtonBarRenderer.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/SingleStepButtonBarRenderer.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/SingleStepButtonBarRenderer.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SingleStepButtonBarRenderer.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.Map;
import javax.faces.component.UIComponent;
@@ -33,9 +34,9 @@
import org.apache.myfaces.trinidad.context.RenderingContext;
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
import org.apache.myfaces.trinidad.util.IntegerUtils;
-
import org.apache.myfaces.trinidadinternal.util.nls.StringUtils;
+
/**
* Renderer for singleStepButtonBar components
* <p>
@@ -47,9 +48,10 @@
{
super(CoreSingleStepButtonBar.TYPE);
}
-
+
@Override
- protected void findTypeConstants(FacesBean.Type type)
+ protected void findTypeConstants(
+ FacesBean.Type type)
{
super.findTypeConstants(type);
_selectedStepKey = type.findKey("selectedStep");
@@ -61,11 +63,13 @@
@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();
-
+
String source = parameters.get(XhtmlConstants.SOURCE_PARAM);
String id = getClientId(context, component);
if ((source != null) && source.startsWith(id))
@@ -93,27 +97,30 @@
{
return true;
}
-
+
@Override
- protected String getDefaultStyleClass(FacesBean bean)
+ protected String getDefaultStyleClass(
+ UIComponent component,
+ FacesBean bean)
{
return SkinSelectors.AF_SINGLE_STEP_BUTTON_BAR;
}
@Override
protected void encodeAll(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- FacesBean bean) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean
+ ) throws IOException
{
- if (canSkipRendering(context, arc, component))
+ if (canSkipRendering(context, rc, component))
return;
- long currentValue = getSelectedStep(bean);
+ long currentValue = getSelectedStep(component, bean);
// get max value
- long totalItems = getMaxStep(bean);
+ long totalItems = getMaxStep(component, bean);
boolean showBackButton = (currentValue > 1);
boolean showNextButton = ((totalItems == _MAX_VALUE_UNKNOWN) ||
@@ -126,14 +133,14 @@
return;
- String formName = arc.getFormData().getName();
+ String formName = rc.getFormData().getName();
if (formName == null)
{
_LOG.warning("SINGLE_STEP_MUST_INSIDE_FORM");
return;
}
- if (!supportsNavigation(arc))
+ if (!supportsNavigation(rc))
return;
// If we don't support navigation (e.g., printable pages),
@@ -141,7 +148,7 @@
// This will give us the highest fidelity output - that is,
// we avoid creating submit buttons.
boolean renderAsTable = SelectRangeChoiceBarRenderer.__renderAsTable(component);
-
+
// start the rendering
ResponseWriter writer = context.getResponseWriter();
@@ -149,9 +156,9 @@
if (renderAsTable)
{
writer.startElement("table", component);
- renderAllAttributes(context, arc, bean);
+ renderAllAttributes(context, rc, component, bean);
renderId(context, component);
- OutputUtils.renderLayoutTableAttributes(context, arc, "0", null);
+ OutputUtils.renderLayoutTableAttributes(context, rc, "0", null);
writer.startElement("tr", null);
}
@@ -160,10 +167,10 @@
// don't render back button on first step
if (showBackButton)
{
- delegateRenderer(context, arc, component, bean, _backButton);
+ delegateRenderer(context, rc, component, bean, _backButton);
writer.endElement("td");
- _renderSpacerCell(context, arc);
+ _renderSpacerCell(context, rc);
writer.startElement("td", null);
}
@@ -176,13 +183,11 @@
if (totalItems > 2)
{
// the string to be displayed between buttons
- String rangeString = _getRangeString(arc,
- bean,
- currentValue,
- totalItems);
+ String rangeString = _getRangeString(rc,
+ component, bean, currentValue, totalItems);
writer.startElement("span", null);
- renderStyleClass(context, arc,
+ renderStyleClass(context, rc,
SkinSelectors.AF_SINGLE_STEP_BUTTON_BAR_LABEL);
writer.writeText(rangeString, "text");
writer.endElement("span");
@@ -192,11 +197,11 @@
if (showNextButton)
{
writer.endElement("td");
-
- _renderSpacerCell(context, arc);
+
+ _renderSpacerCell(context, rc);
writer.startElement("td", null);
- delegateRenderer(context, arc, component, bean, _nextButton);
+ delegateRenderer(context, rc, component, bean, _nextButton);
}
writer.endElement("td");
@@ -208,8 +213,9 @@
}
}
-
- protected long getSelectedStep(FacesBean bean)
+ protected long getSelectedStep(
+ UIComponent component,
+ FacesBean bean)
{
Object o = bean.getProperty(_selectedStepKey);
if (o == null)
@@ -217,8 +223,9 @@
return toLong(o);
}
-
- protected long getMaxStep(FacesBean bean)
+ protected long getMaxStep(
+ UIComponent component,
+ FacesBean bean)
{
Object o = bean.getProperty(_maxStepKey);
if (o == null)
@@ -226,8 +233,9 @@
return toLong(o);
}
-
- protected String getText(FacesBean bean)
+ protected String getText(
+ UIComponent component,
+ FacesBean bean)
{
return toString(bean.getProperty(_textKey));
}
@@ -236,16 +244,17 @@
* Writes the separator between two elements
*/
protected void renderItemSpacer(
- FacesContext context,
- RenderingContext arc) throws IOException
+ FacesContext context,
+ RenderingContext rc
+ ) throws IOException
{
- if (isPDA(arc))
+ if (isPDA(rc))
{
context.getResponseWriter().writeText(XhtmlConstants.NBSP_STRING, null);
}
else
{
- renderSpacer(context, arc, "5", "1");
+ renderSpacer(context, rc, "5", "1");
}
}
@@ -253,27 +262,28 @@
* Writes the separator between two elements
*/
private void _renderSpacerCell(
- FacesContext context,
- RenderingContext arc
+ FacesContext context,
+ RenderingContext rc
) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
writer.startElement("td", null);
- renderItemSpacer(context, arc);
+ renderItemSpacer(context, rc);
writer.endElement("td");
}
private String _getRangeString(
- RenderingContext arc,
+ RenderingContext rc,
+ UIComponent component,
FacesBean bean,
long start,
long total)
{
- String text = getText(bean);
-
+ String text = getText(component, bean);
+
if (text == null)
- text = arc.getTranslatedString(_STEP_TEXT_KEY);
+ text = rc.getTranslatedString(_STEP_TEXT_KEY);
String pattern;
String[] parameters;
@@ -281,17 +291,17 @@
{
// =-= right now you can't ever get here because we don't show the
// step number if maxStep is unknown, but just in case...
- pattern = arc.getTranslatedString(_SINGLE_RANGE_FORMAT_NO_TOTAL_STRING);
+ pattern = rc.getTranslatedString(_SINGLE_RANGE_FORMAT_NO_TOTAL_STRING);
parameters = new String[]
{
text,
IntegerUtils.getString(start)
};
-
+
}
else
{
- pattern = arc.getTranslatedString(_SINGLE_RANGE_FORMAT_TOTAL_STRING);
+ pattern = rc.getTranslatedString(_SINGLE_RANGE_FORMAT_TOTAL_STRING);
parameters = new String[]
{
text,
@@ -299,7 +309,7 @@
IntegerUtils.getString(total)
};
}
-
+
return XhtmlUtils.getFormattedString(pattern, parameters);
}
@@ -327,51 +337,65 @@
static private class Button extends CommandButtonRenderer
{
- public Button(FacesBean.Type type, boolean next)
+ public Button(
+ FacesBean.Type type,
+ boolean next)
{
super(type);
_next = next;
}
@Override
- protected String getClientId(FacesContext context, UIComponent component)
+ protected String getClientId(
+ FacesContext context,
+ UIComponent component)
{
String clientId = super.getClientId(context, component);
return clientId + (_next ? _NEXT_ID_SUFFIX : _BACK_ID_SUFFIX);
}
@Override
- protected String getShortDesc(FacesBean bean)
+ protected String getShortDesc(
+ UIComponent component,
+ FacesBean bean)
{
return null;
}
@Override
- protected String getStyleClass(FacesBean bean)
+ protected String getStyleClass(
+ UIComponent component,
+ FacesBean bean)
{
return null;
}
-
+
@Override
- protected String getInlineStyle(FacesBean bean)
+ protected String getInlineStyle(
+ UIComponent component,
+ FacesBean bean)
{
return null;
}
@Override
- protected String getText(FacesBean bean)
+ protected String getText(
+ UIComponent component,
+ FacesBean bean)
{
String textAndAccessKey = _getTextAndAccessKey();
return StringUtils.stripMnemonic(textAndAccessKey);
}
@Override
- protected char getAccessKey(FacesBean bean)
+ protected char getAccessKey(
+ UIComponent component,
+ FacesBean bean)
{
String textAndAccessKey = _getTextAndAccessKey();
int index = StringUtils.getMnemonicIndex(textAndAccessKey);
if (index < 0)
- return (char) 0;
+ return 0;
return textAndAccessKey.charAt(index + 1);
}
@@ -379,39 +403,51 @@
@Override
protected void renderEventHandlers(
FacesContext context,
- FacesBean bean) throws IOException
+ UIComponent component,
+ FacesBean bean
+ ) throws IOException
{
context.getResponseWriter().writeAttribute("onclick",
- getOnclick(bean),
+ getOnclick(component, bean),
null);
}
@Override
- protected String getComponentOnclick(FacesBean bean)
+ protected String getComponentOnclick(
+ UIComponent component,
+ FacesBean bean)
{
return null;
}
@Override
- protected boolean getImmediate(FacesBean bean)
+ protected boolean getImmediate(
+ UIComponent component,
+ FacesBean bean)
{
return !_next;
}
@Override
- protected boolean getPartialSubmit(FacesBean bean)
+ protected boolean getPartialSubmit(
+ UIComponent component,
+ FacesBean bean)
{
return false;
}
@Override
- protected boolean getDisabled(FacesBean bean)
+ protected boolean getDisabled(
+ UIComponent component,
+ FacesBean bean)
{
return false;
}
-
+
@Override
- protected String getIcon(FacesBean bean)
+ protected String getIcon(
+ UIComponent component,
+ FacesBean bean)
{
return null;
}
@@ -423,7 +459,6 @@
_next ? _SINGLE_NEXT_TEXT_KEY : _SINGLE_BACK_TEXT_KEY);
}
-
private boolean _next;
}
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SpacerRenderer.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/SpacerRenderer.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/SpacerRenderer.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SpacerRenderer.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,23 +22,24 @@
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.bean.PropertyKey;
import org.apache.myfaces.trinidad.component.core.output.CoreSpacer;
-
import org.apache.myfaces.trinidad.context.RenderingContext;
+
public class SpacerRenderer extends XhtmlRenderer
{
public SpacerRenderer()
{
super(CoreSpacer.TYPE);
}
-
+
@Override
- protected void findTypeConstants(FacesBean.Type type)
+ protected void findTypeConstants(
+ FacesBean.Type type)
{
super.findTypeConstants(type);
_heightKey = type.findKey("height");
@@ -47,20 +48,21 @@
@Override
protected void encodeBegin(
- FacesContext context,
- RenderingContext arc,
- UIComponent comp,
- FacesBean bean) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent comp,
+ FacesBean bean
+ ) throws IOException
{
String id;
if (shouldRenderId(context, comp))
id = getClientId(context, comp);
else
id = null;
-
- String width = getWidth(bean);
- String height = getHeight(bean);
-
+
+ String width = getWidth(comp, bean);
+ String height = getHeight(comp, bean);
+
if (width == null)
{
if (height == null)
@@ -77,23 +79,27 @@
}
else
{
- renderDecorativeIcon(context,
- arc,
+ renderDecorativeIcon(context,
+ rc,
XhtmlRenderer.TRANSPARENT_GIF,
width,
height,
id,
- null,
+ null,
comp);
}
}
- protected String getHeight(FacesBean bean)
+ protected String getHeight(
+ UIComponent component,
+ FacesBean bean)
{
return toString(bean.getProperty(_heightKey));
}
- protected String getWidth(FacesBean bean)
+ protected String getWidth(
+ UIComponent component,
+ FacesBean bean)
{
return toString(bean.getProperty(_widthKey));
}
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/StatusIndicatorRenderer.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/StatusIndicatorRenderer.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/StatusIndicatorRenderer.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/StatusIndicatorRenderer.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.Collections;
import java.util.Map;
@@ -32,6 +33,7 @@
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
import org.apache.myfaces.trinidad.skin.Icon;
+
public class StatusIndicatorRenderer extends XhtmlRenderer
{
public StatusIndicatorRenderer()
@@ -39,7 +41,8 @@
super(CoreStatusIndicator.TYPE);
}
- protected StatusIndicatorRenderer(FacesBean.Type type)
+ protected StatusIndicatorRenderer(
+ FacesBean.Type type)
{
super(type);
}
@@ -55,11 +58,12 @@
FacesContext context,
RenderingContext rc,
UIComponent comp,
- FacesBean bean) throws IOException
+ FacesBean bean
+ ) throws IOException
{
UIComponent busyFacet = comp.getFacet(CoreStatusIndicator.BUSY_FACET);
UIComponent readyFacet = comp.getFacet(CoreStatusIndicator.READY_FACET);
-
+
boolean iconMode = false;
Icon busyIcon = null;
Icon readyIcon = null;
@@ -74,52 +78,52 @@
_LOG.warning("STATUS_INDICATOR_MISSING_ICONS");
return;
}
-
+
iconMode = true;
}
-
+
ResponseWriter rw = context.getResponseWriter();
String clientId = getClientId(context, comp);
-
+
// Renders root DOM
rw.startElement(XhtmlConstants.SPAN_ELEMENT, comp);
renderId(context, comp);
- renderAllAttributes(context, rc, bean);
-
+ renderAllAttributes(context, rc, comp, bean);
+
// Renders ready DOM
rw.startElement(XhtmlConstants.SPAN_ELEMENT, null);
rw.writeAttribute(XhtmlConstants.ID_ATTRIBUTE, clientId + "::ready", null);
-
+
if (iconMode)
{
_renderIcon(context, rc, readyIcon, "af_statusIndicator.READY");
}
else
{
- _renderFacet(context, rc, readyFacet,
+ _renderFacet(context, rc, readyFacet,
SkinSelectors.AF_STATUS_INDICATOR_READY_STYLE);
}
-
+
rw.endElement(XhtmlConstants.SPAN_ELEMENT);
-
+
// Renders busy DOM
rw.startElement(XhtmlConstants.SPAN_ELEMENT, null);
rw.writeAttribute(XhtmlConstants.ID_ATTRIBUTE, clientId + "::busy", null);
rw.writeAttribute(XhtmlConstants.STYLE_ATTRIBUTE, "display:none", null);
-
+
if (iconMode)
{
_renderIcon(context, rc, busyIcon, "af_statusIndicator.BUSY");
}
else
{
- _renderFacet(context, rc, busyFacet,
+ _renderFacet(context, rc, busyFacet,
SkinSelectors.AF_STATUS_INDICATOR_BUSY_STYLE);
}
-
+
rw.endElement(XhtmlConstants.SPAN_ELEMENT);
-
+
rw.startElement(XhtmlConstants.SCRIPT_ELEMENT, null);
renderScriptTypeAttribute(context, rc);
rw.writeText("TrStatusIndicator._register(\"" + clientId + "\");", null);
@@ -129,21 +133,24 @@
}
@Override
- protected String getDefaultStyleClass(FacesBean bean)
+ protected String getDefaultStyleClass(
+ UIComponent component,
+ FacesBean bean)
{
return SkinSelectors.AF_STATUS_INDICATOR_STYLE;
}
private void _renderFacet(
- FacesContext context,
+ FacesContext context,
RenderingContext rc,
UIComponent facet,
- String styleClass) throws IOException
+ String styleClass
+ ) throws IOException
{
if (facet != null && facet.isRendered())
{
ResponseWriter rw = context.getResponseWriter();
-
+
rw.startElement(XhtmlConstants.SPAN_ELEMENT, null);
renderStyleClass(context, rc, styleClass);
encodeChild(context, facet);
@@ -152,21 +159,22 @@
}
private void _renderIcon(
- FacesContext context,
- RenderingContext rc,
+ FacesContext context,
+ RenderingContext rc,
Icon icon,
- String iconDesc) throws IOException
+ String iconDesc
+ ) throws IOException
{
if (icon != null && !icon.isNull())
{
- Map<String, String> attrs =
- Collections.singletonMap(Icon.SHORT_DESC_KEY,
+ Map<String, String> attrs =
+ Collections.singletonMap(Icon.SHORT_DESC_KEY,
rc.getTranslatedString(iconDesc));
-
+
icon.renderIcon(context, rc, attrs);
}
}
- private static final TrinidadLogger _LOG =
+ private static final TrinidadLogger _LOG =
TrinidadLogger.createTrinidadLogger(StatusIndicatorRenderer.class);
}
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/StyleSheetRenderer.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/StyleSheetRenderer.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/StyleSheetRenderer.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/StyleSheetRenderer.java Thu Dec 17 02:33:05 2009
@@ -23,8 +23,6 @@
import java.util.List;
import java.util.Map;
-import java.util.Set;
-
import javax.faces.component.UIComponent;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
@@ -33,9 +31,6 @@
import org.apache.myfaces.trinidad.bean.FacesBean;
import org.apache.myfaces.trinidad.component.core.CoreStyleSheet;
import org.apache.myfaces.trinidad.context.RenderingContext;
-import org.apache.myfaces.trinidad.style.Selector;
-import org.apache.myfaces.trinidad.style.Style;
-import org.apache.myfaces.trinidad.style.Styles;
import org.apache.myfaces.trinidadinternal.agent.TrinidadAgent;
import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderingContext;
import org.apache.myfaces.trinidadinternal.style.StyleContext;
@@ -69,7 +64,8 @@
this(CoreStyleSheet.TYPE);
}
- protected StyleSheetRenderer(FacesBean.Type type)
+ protected StyleSheetRenderer(
+ FacesBean.Type type)
{
super(type);
}
@@ -82,14 +78,15 @@
@Override
protected void encodeAll(
- FacesContext context,
- RenderingContext arc,
- UIComponent comp,
- FacesBean bean) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent comp,
+ FacesBean bean
+ ) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
- StyleContext sContext = ((CoreRenderingContext) arc).getStyleContext();
+ StyleContext sContext = ((CoreRenderingContext) rc).getStyleContext();
StyleProvider provider = sContext.getStyleProvider();
if (provider != null)
@@ -98,7 +95,7 @@
// Check if we want to write out the css into the page or not. In portlet mode the
// producer tries to share the consumer's stylesheet if it matches exactly.
- boolean suppressStylesheet = _isSuppressStylesheet(context, arc);
+ boolean suppressStylesheet = _isSuppressStylesheet(context, rc);
if (!suppressStylesheet)
{
@@ -108,10 +105,10 @@
String contextUri = externalContext.getRequestContextPath();
String baseURL = contextUri + XhtmlConstants.STYLES_CACHE_DIRECTORY;
- String outputMode = arc.getOutputMode();
+ String outputMode = rc.getOutputMode();
// =-=AEW Don't like hardcoding facet names...
if (XhtmlConstants.OUTPUT_MODE_PORTLET.equals(outputMode) &&
- supportsScripting(arc))
+ supportsScripting(rc))
{
writer.startElement("script", null);
writer.writeText("var _adfSS;if(!_adfSS){_adfSS=1;", null);
@@ -148,12 +145,12 @@
}
else
{
- if (arc.getSkin() == null)
+ if (rc.getSkin() == null)
writer.writeComment("ERROR: Could not create stylesheet, because " +
"no skin is available");
else
writer.writeComment("ERROR: could not create stylesheet for " +
- arc.getSkin().getStyleSheetName());
+ rc.getSkin().getStyleSheetName());
}
}
@@ -161,10 +158,10 @@
// Hand the Faces-major renderers the style Map for compressing.
// Oddly enough, this code has to be after provider.getStyleSheetURI(),
// because that call boostraps up the style provider in general.
- if (arc instanceof CoreRenderingContext)
+ if (rc instanceof CoreRenderingContext)
{
- Map<String, String> shortStyles = arc.getSkin().getStyleClassMap(arc);
- ((CoreRenderingContext) arc).setStyleMap(shortStyles);
+ Map<String, String> shortStyles = rc.getSkin().getStyleClassMap(rc);
+ ((CoreRenderingContext) rc).setStyleMap(shortStyles);
}
}
}
@@ -175,15 +172,17 @@
// Also, if the Agent Capability cannot handle external css files, this will
// return true.
// returns true if the stylesheet should be suppressed and not written out in the page.
- private boolean _isSuppressStylesheet(FacesContext context, RenderingContext arc)
+ private boolean _isSuppressStylesheet(
+ FacesContext context,
+ RenderingContext rc)
{
// first see if the agent's capability does not support external css files.
- if (!_supportsExternalStylesheet(arc))
+ if (!_supportsExternalStylesheet(rc))
return true;
// next check if in portlet mode, and if the suppress stylesheet parameter
// is set, and it's valid to suppress the stylesheet.
- String outputMode = arc.getOutputMode();
+ String outputMode = rc.getOutputMode();
if (XhtmlConstants.OUTPUT_MODE_PORTLET.equals(outputMode))
{
Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
@@ -192,8 +191,8 @@
{
// the portlet producer requests that we suppress the stylesheet if the producer's skin
// and the consumer's skin match exactly.
- return ((CoreRenderingContext) arc).isRequestMapStyleSheetIdAndSkinEqual(
- context, arc.getSkin());
+ return ((CoreRenderingContext) rc).isRequestMapStyleSheetIdAndSkinEqual(
+ context, rc.getSkin());
}
}
return false;
@@ -202,9 +201,10 @@
// Get the Capability from the agent and return true if the
// TrinidadAgent.CAP_STYLE_ATTRIBUTES == STYLES_EXTERNAL.
// Defaults to true in case no capability is set.
- static private boolean _supportsExternalStylesheet(RenderingContext arc)
+ static private boolean _supportsExternalStylesheet(
+ RenderingContext rc)
{
- Object styleCapability = arc.getAgent().getCapabilities().get(
+ Object styleCapability = rc.getAgent().getCapabilities().get(
TrinidadAgent.CAP_STYLE_ATTRIBUTES);
return (styleCapability == null ||
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/TableRenderer.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/TableRenderer.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/TableRenderer.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/TableRenderer.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
@@ -34,7 +34,6 @@
import javax.faces.context.ResponseWriter;
import javax.faces.event.FacesEvent;
-import org.apache.myfaces.trinidad.logging.TrinidadLogger;
import org.apache.myfaces.trinidad.bean.FacesBean;
import org.apache.myfaces.trinidad.bean.PropertyKey;
import org.apache.myfaces.trinidad.component.CollectionComponent;
@@ -46,17 +45,18 @@
import org.apache.myfaces.trinidad.component.core.data.CoreTable;
import org.apache.myfaces.trinidad.context.Agent;
import org.apache.myfaces.trinidad.context.FormData;
-import org.apache.myfaces.trinidad.context.RequestContext;
import org.apache.myfaces.trinidad.context.PartialPageContext;
import org.apache.myfaces.trinidad.context.RenderingContext;
-import org.apache.myfaces.trinidad.event.RowDisclosureEvent;
+import org.apache.myfaces.trinidad.context.RequestContext;
import org.apache.myfaces.trinidad.event.RangeChangeEvent;
+import org.apache.myfaces.trinidad.event.RowDisclosureEvent;
import org.apache.myfaces.trinidad.event.SortEvent;
+import org.apache.myfaces.trinidad.logging.TrinidadLogger;
import org.apache.myfaces.trinidad.model.RowKeySet;
import org.apache.myfaces.trinidad.model.SortCriterion;
import org.apache.myfaces.trinidad.render.ClientRowKeyManager;
import org.apache.myfaces.trinidad.render.CoreRenderer;
-
+import org.apache.myfaces.trinidad.util.IntegerUtils;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.table.CellUtils;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.table.ColumnData;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.table.DetailColumnRenderer;
@@ -67,18 +67,20 @@
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.table.TableSelectManyRenderer;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.table.TableSelectOneRenderer;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.table.TreeUtils;
-import org.apache.myfaces.trinidad.util.IntegerUtils;
+
abstract public class TableRenderer extends XhtmlRenderer
{
- public TableRenderer(FacesBean.Type type)
+ public TableRenderer(
+ FacesBean.Type type)
{
super(type);
_resourceKeyMap = createResourceKeyMap();
}
@Override
- protected void findTypeConstants(FacesBean.Type type)
+ protected void findTypeConstants(
+ FacesBean.Type type)
{
super.findTypeConstants(type);
_widthKey = type.findKey("width");
@@ -97,13 +99,15 @@
@SuppressWarnings("unchecked")
@Override
- public void decode(FacesContext context, UIComponent component)
+ public void decode(
+ FacesContext context,
+ UIComponent component)
{
decodeSelection(context, component);
- Map<String, String> parameters =
+ Map<String, String> parameters =
context.getExternalContext().getRequestParameterMap();
-
+
String source = parameters.get(XhtmlConstants.SOURCE_PARAM);
String id = component.getClientId(context);
if (!id.equals(source))
@@ -128,7 +132,9 @@
RequestContext.getCurrentInstance().addPartialTarget(table);
}
- protected final void decodeSelection(FacesContext context, UIComponent treeTable)
+ protected final void decodeSelection(
+ FacesContext context,
+ UIComponent treeTable)
{
String selection = (String)
treeTable.getAttributes().get(CoreTable.ROW_SELECTION_KEY.getName());
@@ -138,8 +144,9 @@
_selectMany.decode(context, treeTable);
}
- public static RangeChangeEvent createRangeChangeEvent(CollectionComponent table,
- int newStart)
+ public static RangeChangeEvent createRangeChangeEvent(
+ CollectionComponent table,
+ int newStart)
{
int newEnd = TableUtils.getLast(table, newStart);
@@ -154,18 +161,18 @@
*/
static public Set<Object> getPartialRowKeys(
FacesContext context,
- RenderingContext arc,
+ RenderingContext rc,
UIComponent component,
String clientId)
{
ClientRowKeyManager rowKeyManager = null;
if (component instanceof UIXCollection)
rowKeyManager = ((UIXCollection) component).getClientRowKeyManager();
-
+
Set<Object> rowKeys = null;
String tablePrefix = clientId + NamingContainer.SEPARATOR_CHAR;
// Search for any PPR targets that start with "<tableClientId>:"
- PartialPageContext ppc = arc.getPartialPageContext();
+ PartialPageContext ppc = rc.getPartialPageContext();
Iterator<String> targets = ppc.getPartialTargets();
while (targets.hasNext())
{
@@ -178,26 +185,26 @@
// has partial targets, but we can't process the rows individually
if (rowKeyManager == null)
return null;
-
+
// Extract the client rowkey from the clientId
String clientRowKey = target.substring(tablePrefix.length());
int ncIndex = clientRowKey.indexOf(NamingContainer.SEPARATOR_CHAR);
- // If we have a target that is in the table, but is not in a
+ // If we have a target that is in the table, but is not in a
// particular row, just repaint the whole table
if (ncIndex < 0)
return null;
-
+
clientRowKey = clientRowKey.substring(0, ncIndex);
-
+
// Try to turn it into a server rowkey
Object rowKey = rowKeyManager.getRowKey(context, component, clientRowKey);
// if this fails, we have to process the whole table
if (rowKey == null)
return null;
-
+
// We know this row exists, and needs to be processed
if (rowKeys == null)
- rowKeys = new HashSet<Object>();
+ rowKeys = new HashSet<Object>();
rowKeys.add(rowKey);
}
}
@@ -211,16 +218,17 @@
private static RangeChangeEvent _createRangeChangeEvent(
CollectionComponent table,
- int newStart,
- int newEnd)
+ int newStart,
+ int newEnd)
{
int oldStart = table.getFirst();
int oldEnd = TableUtils.getLast(table) + 1;
return
new RangeChangeEvent((UIComponent) table, oldStart, oldEnd, newStart, newEnd);
}
+
private void _decodeSort(
- UIXTable table,
+ UIXTable table,
Map<String, String> parameters)
{
String property = parameters.get(XhtmlConstants.VALUE_PARAM);
@@ -234,7 +242,7 @@
}
private void _decodeGoto(
- UIXTable table,
+ UIXTable table,
Map<String, String> parameters)
{
String value = parameters.get(XhtmlConstants.VALUE_PARAM);
@@ -272,9 +280,9 @@
@SuppressWarnings("unchecked")
private void _decodeHideShow(
- UIXTable table,
+ UIXTable table,
Map<String, String> parameters,
- Object eventParam)
+ Object eventParam)
{
boolean doExpand = XhtmlConstants.SHOW_EVENT.equals(eventParam);
Object value = parameters.get(XhtmlConstants.VALUE_PARAM);
@@ -306,19 +314,20 @@
@Override
protected void encodeAll(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- FacesBean bean) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean
+ ) throws IOException
{
Set<Object> keysToRender = null;
// See if we can skip rendering altogether
- if (canSkipRendering(context, arc, component))
+ if (canSkipRendering(context, rc, component))
{
// If we're in here, then the table itself as a whole doesn't
// need to be re-rendered - but the contents might need to be!
keysToRender = getPartialRowKeys(context,
- arc,
+ rc,
component,
getClientId(context, component));
// getPartialRowKeys() has a weird API. null means there are contents
@@ -334,14 +343,14 @@
}
// save current skin resource map, if any, on the local property
- Map<String, String> oldSkinResourceMap = arc.getSkinResourceKeyMap();
+ Map<String, String> oldSkinResourceMap = rc.getSkinResourceKeyMap();
// store TableRenderer's skin resource map, so that called to
// context.getTranslatedValue will get the correct key.
- arc.setSkinResourceKeyMap(_resourceKeyMap);
+ rc.setSkinResourceKeyMap(_resourceKeyMap);
TableRenderingContext tContext = createRenderingContext(context,
- arc,
+ rc,
component);
try
@@ -352,27 +361,27 @@
rw.startElement("div", component);
renderId(context, component);
- renderAllAttributes(context, arc, bean);
+ renderAllAttributes(context, rc, component, bean);
// If we need to render a "special" empty table, then bail.
- if (renderTableWithoutColumns(context, arc, tContext, component))
+ if (renderTableWithoutColumns(context, rc, tContext, component))
return;
// start the outer table:
rw.startElement(XhtmlConstants.TABLE_ELEMENT, null);
- renderTableAttributes(context, arc, component, bean, "0", "0");
+ renderTableAttributes(context, rc, component, bean, "0", "0");
RenderStage renderStage = tContext.getRenderStage();
assert (renderStage.getStage()==RenderStage.INITIAL_STAGE);
// give the table's columns a chance to initialize:
- renderSingleRow(context, arc, tContext, component);
+ renderSingleRow(context, rc, tContext, component);
// 1. render the header bars (title, controlbar and subcontrolbar)
- renderNavigationHeaderBars(context, arc, tContext, component, bean);
+ renderNavigationHeaderBars(context, rc, tContext, component, bean);
// 2. render the table content
- renderTableContent(context, arc, tContext, component);
+ renderTableContent(context, rc, tContext, component);
// end the outertable:
rw.endElement(XhtmlConstants.TABLE_ELEMENT);
@@ -380,10 +389,10 @@
// gives some beans the chance to cleanup:
renderStage.setStage(RenderStage.END_STAGE);
- renderSingleRow(context, arc, tContext, component);
+ renderSingleRow(context, rc, tContext, component);
String tid = tContext.getTableId();
- FormData formData = arc.getFormData();
+ FormData formData = rc.getFormData();
if (formData != null)
{
// Add sorting parameters.
@@ -392,13 +401,13 @@
formData.addNeededValue(XhtmlConstants.VALUE_PARAM);
//HKuhn - no need for scripts in printable mode
- if (supportsScripting(arc))
+ if (supportsScripting(rc))
{
rw.startElement(XhtmlConstants.SCRIPT_ELEMENT, null);
- renderScriptDeferAttribute(context, arc);
+ renderScriptDeferAttribute(context, rc);
// Bug #3426092:
// render the type="text/javascript" attribute in accessibility mode
- renderScriptTypeAttribute(context, arc);
+ renderScriptTypeAttribute(context, rc);
String formName = formData.getName();
@@ -410,9 +419,9 @@
int first = tContext.getCollectionComponent().getFirst();
- if (supportsScripting(arc))
+ if (supportsScripting(rc))
{
- XhtmlUtils.addLib(context, arc, "TableProxy()");
+ XhtmlUtils.addLib(context, rc, "TableProxy()");
// Bug #2378405: Add a javascript variable giving the row number of
// the first row in the displayed rowset.
@@ -435,10 +444,10 @@
if (value != 1)
{
rw.startElement(XhtmlConstants.SCRIPT_NAME, null);
- renderScriptDeferAttribute(context, arc);
+ renderScriptDeferAttribute(context, rc);
// Bug #3426092:
// render the type="text/javascript" attribute in accessibility mode
- renderScriptTypeAttribute(context, arc);
+ renderScriptTypeAttribute(context, rc);
rw.writeText("window[\"_", null);
rw.writeText(tContext.getTableId(), null);
rw.writeText(_VALUE_FIELD_NAME, null);
@@ -457,7 +466,7 @@
finally
{
// restore current skin resource map. Most likely there won't be one.
- arc.setSkinResourceKeyMap(oldSkinResourceMap);
+ rc.setSkinResourceKeyMap(oldSkinResourceMap);
if (tContext != null)
tContext.release();
@@ -466,7 +475,10 @@
}
@Override
- protected String getDefaultStyleClass(FacesBean bean) {
+ protected String getDefaultStyleClass(
+ UIComponent component,
+ FacesBean bean)
+ {
return SkinSelectors.AF_TABLE_STYLE;
}
@@ -475,18 +487,18 @@
* this includes width, cellpadding, cellspacing, border.
*/
protected void renderTableAttributes(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- FacesBean bean,
- Object cellPadding,
- Object border
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean,
+ Object cellPadding,
+ Object border
) throws IOException
{
- Object width = getWidth(bean);
+ Object width = getWidth(component, bean);
OutputUtils.renderLayoutTableAttributes(context,
- arc,
+ rc,
cellPadding,
"0", // cell spacing
border,
@@ -498,20 +510,20 @@
* use for this Renderer.
*/
protected TableRenderingContext createRenderingContext(
- FacesContext context,
- RenderingContext arc,
- UIComponent component
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component
)
{
- return new TableRenderingContext(context, arc, component);
+ return new TableRenderingContext(context, rc, component);
}
protected abstract void renderSingleRow(
FacesContext context,
- RenderingContext arc,
+ RenderingContext rc,
TableRenderingContext tContext,
- UIComponent component) throws IOException;
-
+ UIComponent component
+ ) throws IOException;
/**
* Render an empty table, if necessary.
@@ -521,9 +533,10 @@
*/
protected boolean renderTableWithoutColumns(
FacesContext context,
- RenderingContext arc,
+ RenderingContext rc,
TableRenderingContext tContext,
- UIComponent component) throws IOException
+ UIComponent component
+ ) throws IOException
{
ColumnData colData = tContext.getColumnData();
if (colData.getColumnCount() <= 0)
@@ -540,7 +553,7 @@
writer.startElement(XhtmlConstants.TABLE_ROW_ELEMENT, null);
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
writer.writeAttribute(XhtmlConstants.WIDTH_ATTRIBUTE, "30", null);
- renderStyleClasses(context, arc,
+ renderStyleClasses(context, rc,
new String[]{
SkinSelectors.AF_COLUMN_CELL_TEXT_STYLE,
CellUtils.getBorderClass(
@@ -549,7 +562,7 @@
true,
true)});
- renderSpacer(context, arc, "30", "30");
+ renderSpacer(context, rc, "30", "30");
writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
writer.endElement(XhtmlConstants.TABLE_ROW_ELEMENT);
writer.endElement(XhtmlConstants.TABLE_ELEMENT);
@@ -566,11 +579,11 @@
@SuppressWarnings("unchecked")
protected int renderSpecialColumns(
FacesContext context,
- RenderingContext arc,
+ RenderingContext rc,
TableRenderingContext tContext,
UIComponent treeTable,
- int physicalColumnIndex)
- throws IOException
+ int physicalColumnIndex
+ ) throws IOException
{
// renders a whole bunch of <TH>...</TH> elements, or <TD>..</TD> elements
// depending on the RenderStage
@@ -582,7 +595,7 @@
{
if (hidden[i] != TableRenderingContext.NORMAL_COLUMN)
continue;
-
+
UIComponent child = children.get(i);
if (!(child instanceof UIXColumn))
continue;
@@ -609,7 +622,7 @@
{
colData.setColumnIndex(physicalColumnIndex, ColumnData.SPECIAL_COLUMN_INDEX);
- _renderSelectionColumn(context, arc, tContext);
+ _renderSelectionColumn(context, rc, tContext);
physicalColumnIndex++;
}
// special case... render the detail column
@@ -617,7 +630,7 @@
if (detail != null)
{
colData.setColumnIndex(physicalColumnIndex, ColumnData.SPECIAL_COLUMN_INDEX);
- _renderDetailColumn(context, arc);
+ _renderDetailColumn(context, rc);
physicalColumnIndex++;
}
@@ -626,30 +639,32 @@
}
private void _renderDetailColumn(
- FacesContext context,
- RenderingContext arc) throws IOException
+ FacesContext context,
+ RenderingContext rc
+ ) throws IOException
{
UIComponent column = _detailRenderer.getSpecialColumn();
- delegateRenderer(context, arc, column,
+ delegateRenderer(context, rc, column,
getFacesBean(column), _detailRenderer);
}
private void _renderSelectionColumn(
FacesContext context,
- RenderingContext arc,
- TableRenderingContext tContext) throws IOException
+ RenderingContext rc,
+ TableRenderingContext tContext
+ ) throws IOException
{
- Map<String, String> originalResourceKeyMap = arc.getSkinResourceKeyMap();
- setSelectionResourceKeyMap(arc, tContext);
+ Map<String, String> originalResourceKeyMap = rc.getSkinResourceKeyMap();
+ setSelectionResourceKeyMap(rc, tContext);
try
{
UIComponent column = _selectRenderer.getSpecialColumn();
- delegateRenderer(context, arc, column,
+ delegateRenderer(context, rc, column,
getFacesBean(column), _selectRenderer);
}
finally
{
- arc.setSkinResourceKeyMap(originalResourceKeyMap);
+ rc.setSkinResourceKeyMap(originalResourceKeyMap);
}
}
@@ -659,19 +674,20 @@
*/
protected void renderNavigationHeaderBars(
FacesContext context,
- RenderingContext arc,
+ RenderingContext rc,
TableRenderingContext tContext,
UIComponent component,
- FacesBean bean) throws IOException
+ FacesBean bean
+ ) throws IOException
{
// 2. render the upper control bar - must render tableActions even
// if table is empty
- _renderControlBar(context, arc, tContext, component, true); //isUpper
+ _renderControlBar(context, rc, tContext, component, true); //isUpper
// render the sub control bar. we need to to this even if the table is empty
// because we need to render the filter area. bug 3757395
- renderSubControlBar(context, arc, tContext, component, true);
+ renderSubControlBar(context, rc, tContext, component, true);
}
/**
@@ -679,14 +695,15 @@
*/
private void _renderControlBar(
FacesContext context,
- RenderingContext arc,
+ RenderingContext rc,
TableRenderingContext tContext,
UIComponent component,
- boolean isUpper) throws IOException
+ boolean isUpper
+ ) throws IOException
{
// indicate that this is a repeating region, so that beans like the
// choiceBean can stay synchronized
- arc.getProperties().put(XhtmlConstants.REPEAT_PROPERTY,
+ rc.getProperties().put(XhtmlConstants.REPEAT_PROPERTY,
Boolean.TRUE);
RenderStage rs = tContext.getRenderStage();
@@ -708,68 +725,67 @@
// We only generate the navigation bar ID if the agent is IE
// and partial rendering is enabled.
Object id = tContext.getTableId();
- Agent agent = arc.getAgent();
+ Agent agent = rc.getAgent();
if ((agent.getAgentName() == Agent.AGENT_IE) &&
PartialPageUtils.isPPRActive(context))
{
String navBarID = id.toString() + "-nb";
- setRenderingProperty(arc, _UPPER_NAV_BAR_ID_PROPERTY, navBarID);
+ setRenderingProperty(rc, _UPPER_NAV_BAR_ID_PROPERTY, navBarID);
}
}
- renderControlBar(context, arc, tContext, component);
+ renderControlBar(context, rc, tContext, component);
// no longer a repeating region
- arc.getProperties().remove(XhtmlConstants.REPEAT_PROPERTY);
+ rc.getProperties().remove(XhtmlConstants.REPEAT_PROPERTY);
if (isUpper)
- setRenderingProperty(arc, _UPPER_NAV_BAR_ID_PROPERTY, null);
+ setRenderingProperty(rc, _UPPER_NAV_BAR_ID_PROPERTY, null);
}
-
/**
* Renders the control bar
*/
protected abstract void renderControlBar(
FacesContext context,
- RenderingContext arc,
+ RenderingContext rc,
TableRenderingContext tContext,
- UIComponent component)
- throws IOException;
-
-
+ UIComponent component
+ ) throws IOException;
/**
* Render sthe area with the filter and links, if necessary
*/
protected abstract void renderSubControlBar(
FacesContext context,
- RenderingContext arc,
+ RenderingContext rc,
TableRenderingContext tContext,
UIComponent component,
- boolean isUpper) throws IOException;
-
-
-
-
+ boolean isUpper
+ ) throws IOException;
/**
* Renders the actual table content, with headers
*/
protected abstract void renderTableContent(
FacesContext context,
- RenderingContext arc,
+ RenderingContext rc,
TableRenderingContext tContext,
- UIComponent component) throws IOException;
+ UIComponent component
+ ) throws IOException;
- protected String getEmptyText(FacesBean bean)
+ protected String getEmptyText(
+ UIComponent component,
+ FacesBean bean)
{
return toString(bean.getProperty(_emptyTextKey));
}
- protected Object getWidth(FacesBean bean)
+ protected Object getWidth(
+ UIComponent component,
+ FacesBean bean)
{
return bean.getProperty(_widthKey);
}
@@ -804,8 +820,9 @@
* and column headers should just call
* ColumnGroupRenderer.getHeaderStyleClass()
*/
- public static String getHeaderFormatClass(TableRenderingContext tContext,
- boolean isColumnHeader)
+ public static String getHeaderFormatClass(
+ TableRenderingContext tContext,
+ boolean isColumnHeader)
{
if (isColumnHeader)
throw new IllegalStateException(_LOG.getMessage(
@@ -823,14 +840,14 @@
* @todo reuse these Maps!
*/
public static void setSelectionResourceKeyMap(
- RenderingContext arc,
+ RenderingContext rc,
TableRenderingContext tContext)
{
if (tContext.hasSelection())
{
- Map<String, String> selectionColumnStylesMap =
+ Map<String, String> selectionColumnStylesMap =
new HashMap<String, String>();
-
+
// if selection is multiple-selection:
if (tContext.hasSelectAll())
{
@@ -846,13 +863,15 @@
selectionColumnStylesMap.put(SkinSelectors.AF_COLUMN_CELL_ICON_BAND_STYLE,
SkinSelectors.AF_TABLE_SELECT_ONE_CELL_ICON_BAND_STYLE);
}
- arc.setSkinResourceKeyMap(selectionColumnStylesMap);
+ rc.setSkinResourceKeyMap(selectionColumnStylesMap);
}
}
@Override
- protected boolean shouldRenderId(FacesContext context, UIComponent component)
+ protected boolean shouldRenderId(
+ FacesContext context,
+ UIComponent component)
{
return true;
}
@@ -895,26 +914,32 @@
static private class NavBar extends SelectRangeChoiceBarRenderer
{
- public NavBar(FacesBean.Type type)
+ public NavBar(
+ FacesBean.Type type)
{
super(type);
}
@Override
protected void renderAllAttributes(
- FacesContext context, RenderingContext arc, FacesBean bean)
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean)
{
}
@Override
- protected boolean getShowAll(FacesBean bean)
+ protected boolean getShowAll(
+ UIComponent component,
+ FacesBean bean)
{
TableRenderingContext tContext =
TableRenderingContext.getCurrentInstance();
- UIComponent component = tContext.getTable();
- if (component instanceof UIXTable)
+ UIComponent c = tContext.getTable();
+ if (c instanceof UIXTable)
{
- UIXTable table = (UIXTable) component;
+ UIXTable table = (UIXTable)c;
return table.isShowAll();
}
@@ -929,8 +954,7 @@
TableRenderingContext.getCurrentInstance();
UIComponent component = tContext.getTable();
return (component instanceof UIXTable);
- }
-
+ }
@Override
protected String getSource()
@@ -944,7 +968,9 @@
* @todo Deal with repeating!
*/
@Override
- protected String getClientId(FacesContext context, UIComponent component)
+ protected String getClientId(
+ FacesContext context,
+ UIComponent component)
{
TableRenderingContext tContext =
TableRenderingContext.getCurrentInstance();
@@ -952,66 +978,80 @@
}
@Override
- protected String getVar(FacesBean bean)
+ protected String getVar(
+ UIComponent component,
+ FacesBean bean)
{
return null;
}
// No support for range labels
@Override
- protected UIComponent getRangeLabel(UIComponent component)
+ protected UIComponent getRangeLabel(
+ UIComponent component)
{
return null;
}
@Override
- protected int getRowCount(UIComponent component)
+ protected int getRowCount(
+ UIComponent component)
{
return ((CollectionComponent) component).getRowCount();
}
@Override
- protected int getRowIndex(UIComponent component)
+ protected int getRowIndex(
+ UIComponent component)
{
return ((CollectionComponent) component).getRowIndex();
}
@Override
- protected void setRowIndex(UIComponent component, int index)
+ protected void setRowIndex(
+ UIComponent component,
+ int index)
{
((CollectionComponent) component).setRowIndex(index);
}
@Override
- protected boolean isRowAvailable(UIComponent component)
+ protected boolean isRowAvailable(
+ UIComponent component)
{
return ((CollectionComponent) component).isRowAvailable();
}
@Override
- protected boolean isRowAvailable(UIComponent component, int rowIndex)
+ protected boolean isRowAvailable(
+ UIComponent component,
+ int rowIndex)
{
return ((UIXCollection) component).isRowAvailable(rowIndex);
}
@Override
- protected Object getRowData(UIComponent component)
+ protected Object getRowData(
+ UIComponent component)
{
return ((CollectionComponent) component).getRowData();
}
@Override
- protected int getRows(UIComponent component, FacesBean bean)
+ protected int getRows(
+ UIComponent component,
+ FacesBean bean)
{
return ((CollectionComponent) component).getRows();
}
@Override
- protected int getFirst(UIComponent component, FacesBean bean)
+ protected int getFirst(
+ UIComponent component,
+ FacesBean bean)
{
return ((CollectionComponent) component).getFirst();
}
-
}
private PropertyKey _widthKey;