Author: andrei_exadel
Date: 2008-07-23 05:10:15 -0400 (Wed, 23 Jul 2008)
New Revision: 9737
Modified:
trunk/ui/columns/src/main/java/org/richfaces/taglib/ColumnsTag.java
Log:
refactoring
Modified: trunk/ui/columns/src/main/java/org/richfaces/taglib/ColumnsTag.java
===================================================================
--- trunk/ui/columns/src/main/java/org/richfaces/taglib/ColumnsTag.java 2008-07-22
23:32:51 UTC (rev 9736)
+++ trunk/ui/columns/src/main/java/org/richfaces/taglib/ColumnsTag.java 2008-07-23
09:10:15 UTC (rev 9737)
@@ -1,5 +1,6 @@
package org.richfaces.taglib;
+import java.beans.FeatureDescriptor;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collection;
@@ -341,7 +342,7 @@
for (Field field : fields) {
try {
Object o = field.get(this);
- if ((o != null) && o instanceof ValueExpression) {
+ if (o != null && o instanceof ValueExpression) {
String fieldName = field.getName();
if (fieldName != null && fieldName.startsWith("_")) {
String attributeName = fieldName.replace("_", "");
@@ -351,16 +352,18 @@
}
}
+
} catch (Exception e) {
continue;
}
- }
- if (this._filterMethod != null) {
- MethodInfo info = _filterMethod.getMethodInfo(pageContext.getELContext());
+ }
+ // Set filterMethod attribute
+ if (_filterMethod != null) {
MethodExpression mexpr = getFacesContext().getApplication()
- .getExpressionFactory().createMethodExpression(elContext,
- _filterMethod.getExpressionString(), info.getReturnType(), info.getParamTypes());
- ((HtmlColumn)component).setFilterMethod(mexpr);
+ .getExpressionFactory().createMethodExpression(elContext,
+ _filterMethod.getExpressionString(), Object.class,
+ new Class[] { Object.class });
+ ((HtmlColumn) component).setFilterMethod(mexpr);
}
}
@@ -454,11 +457,11 @@
initBegin();
initEnd();
}
-
+
private void initItarationId() {
String jspId = getJspId();
if (jspId != null) {
- setJspId(jspId); // We need it twice!
+ setJspId(jspId); // We need it twice!
setJspId(jspId);
}
}
@@ -520,9 +523,9 @@
try {
Object o = __begin.getValue(getELContext());
if (o instanceof Number) {
- begin = ((Number)o).intValue();
+ begin = ((Number) o).intValue();
} else if (o instanceof String) {
- begin = Integer.parseInt((String)o);
+ begin = Integer.parseInt((String) o);
}
begin--; // correct begin value
if (begin < 0) {
@@ -544,9 +547,9 @@
try {
Object o = __end.getValue(getELContext());
if (o instanceof Number) {
- end = ((Number)o).intValue();
+ end = ((Number) o).intValue();
} else if (o instanceof String) {
- end = Integer.parseInt((String)o);
+ end = Integer.parseInt((String) o);
}
if (end < 0) {
end = 0;
@@ -625,14 +628,17 @@
return new ELContext() {
@Override
+ public Object getContext(Class key) {
+ return cont.getContext(key);
+ }
+
+ @Override
public ELResolver getELResolver() {
- // TODO Auto-generated method stub
return cont.getELResolver();
}
@Override
public FunctionMapper getFunctionMapper() {
- // TODO Auto-generated method stub
return cont.getFunctionMapper();
}
@@ -642,7 +648,6 @@
@Override
public ValueExpression resolveVariable(String variable) {
- // TODO Auto-generated method stub
if (variable.equals(itemId)) {
return new IndexedValueExpression(__value, index);
} else if (variable.equals(indexId)) {
@@ -655,7 +660,6 @@
@Override
public ValueExpression setVariable(String variable,
ValueExpression expression) {
- // TODO Auto-generated method stub
return cont.getVariableMapper().setVariable(variable,
expression);
}
@@ -749,7 +753,8 @@
|| o instanceof String) {
if (iteratedExpression == null) {
- iteratedExpression = new IteratedExpression(__value, getDelims());
+ iteratedExpression = new IteratedExpression(__value,
+ getDelims());
}
return new IteratedValueExpression(iteratedExpression, index);
}
Show replies by date