JBoss Rich Faces SVN: r21943 - in branches/4.0.0.CR1/ui/validator: ui/src/main/java/org/richfaces/component/behavior and 7 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2011-02-25 15:48:14 -0500 (Fri, 25 Feb 2011)
New Revision: 21943
Modified:
branches/4.0.0.CR1/ui/validator/api/src/main/java/org/richfaces/validator/FacesConverterService.java
branches/4.0.0.CR1/ui/validator/api/src/main/java/org/richfaces/validator/FacesValidatorService.java
branches/4.0.0.CR1/ui/validator/ui/src/main/java/org/richfaces/component/behavior/ClientValidatorImpl.java
branches/4.0.0.CR1/ui/validator/ui/src/main/java/org/richfaces/validator/ConverterServiceImpl.java
branches/4.0.0.CR1/ui/validator/ui/src/main/java/org/richfaces/validator/FacesServiceBase.java
branches/4.0.0.CR1/ui/validator/ui/src/main/java/org/richfaces/validator/FacesValidatorServiceImpl.java
branches/4.0.0.CR1/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/richfaces-csv.js
branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorGetConverterTest.java
branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorGetValidatorTest.java
branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/MockTestBase.java
branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/converter/ByteConverterTest.java
branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/converter/ConverterTestBase.java
branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/converter/NumberConverterTest.java
branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/converter/ShortConverterTest.java
branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/DoubleRangeValidatorTest.java
branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/LengthValidatorTest.java
branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/LongRangeValidatorTest.java
branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/MaxValidatorTest.java
branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/ValidatorTestBase.java
branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/validator/FacesConverterServiceTest.java
branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/validator/FacesValidatorServiceTest.java
Log:
RESOLVED - issue RF-10268: CSV: ValidateLength works wrong without maximum specified
https://issues.jboss.org/browse/RF-10268
https://issues.jboss.org/browse/RF-10611
https://issues.jboss.org/browse/RF-10434
Modified: branches/4.0.0.CR1/ui/validator/api/src/main/java/org/richfaces/validator/FacesConverterService.java
===================================================================
--- branches/4.0.0.CR1/ui/validator/api/src/main/java/org/richfaces/validator/FacesConverterService.java 2011-02-25 20:30:06 UTC (rev 21942)
+++ branches/4.0.0.CR1/ui/validator/api/src/main/java/org/richfaces/validator/FacesConverterService.java 2011-02-25 20:48:14 UTC (rev 21943)
@@ -1,5 +1,6 @@
package org.richfaces.validator;
+import javax.faces.component.EditableValueHolder;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
@@ -11,6 +12,6 @@
*/
public interface FacesConverterService {
- ConverterDescriptor getConverterDescription(FacesContext context,Converter converter);
+ ConverterDescriptor getConverterDescription(FacesContext context,EditableValueHolder input, Converter converter);
}
Modified: branches/4.0.0.CR1/ui/validator/api/src/main/java/org/richfaces/validator/FacesValidatorService.java
===================================================================
--- branches/4.0.0.CR1/ui/validator/api/src/main/java/org/richfaces/validator/FacesValidatorService.java 2011-02-25 20:30:06 UTC (rev 21942)
+++ branches/4.0.0.CR1/ui/validator/api/src/main/java/org/richfaces/validator/FacesValidatorService.java 2011-02-25 20:48:14 UTC (rev 21943)
@@ -1,10 +1,11 @@
package org.richfaces.validator;
+import javax.faces.component.EditableValueHolder;
import javax.faces.context.FacesContext;
import javax.faces.validator.Validator;
public interface FacesValidatorService {
- ValidatorDescriptor getValidatorDescription(FacesContext context,Validator validator);
+ ValidatorDescriptor getValidatorDescription(FacesContext context,EditableValueHolder component, Validator validator);
}
Modified: branches/4.0.0.CR1/ui/validator/ui/src/main/java/org/richfaces/component/behavior/ClientValidatorImpl.java
===================================================================
--- branches/4.0.0.CR1/ui/validator/ui/src/main/java/org/richfaces/component/behavior/ClientValidatorImpl.java 2011-02-25 20:30:06 UTC (rev 21942)
+++ branches/4.0.0.CR1/ui/validator/ui/src/main/java/org/richfaces/component/behavior/ClientValidatorImpl.java 2011-02-25 20:48:14 UTC (rev 21943)
@@ -245,7 +245,7 @@
}
if(null != converter){
FacesConverterService converterService = ServiceTracker.getService(facesContext, FacesConverterService.class);
- return converterService.getConverterDescription(facesContext, converter);
+ return converterService.getConverterDescription(facesContext, input, converter);
} else {
return null;
}
@@ -293,7 +293,7 @@
validators.addAll(beanValidatorService.getConstrains(facesContext, valueExpression, getGroups()));
}
} else {
- validators.add(facesValidatorService.getValidatorDescription(facesContext, validator));
+ validators.add(facesValidatorService.getValidatorDescription(facesContext, input, validator));
}
}
}
Modified: branches/4.0.0.CR1/ui/validator/ui/src/main/java/org/richfaces/validator/ConverterServiceImpl.java
===================================================================
--- branches/4.0.0.CR1/ui/validator/ui/src/main/java/org/richfaces/validator/ConverterServiceImpl.java 2011-02-25 20:30:06 UTC (rev 21942)
+++ branches/4.0.0.CR1/ui/validator/ui/src/main/java/org/richfaces/validator/ConverterServiceImpl.java 2011-02-25 20:48:14 UTC (rev 21943)
@@ -5,6 +5,7 @@
import javax.faces.application.FacesMessage;
+import javax.faces.component.EditableValueHolder;
import javax.faces.component.UIInput;
import javax.faces.context.FacesContext;
import javax.faces.convert.BigDecimalConverter;
@@ -37,9 +38,9 @@
* @see org.richfaces.validator.FacesConverterService#getConverterDescription(javax.faces.context.FacesContext,
* javax.faces.convert.Converter)
*/
- public ConverterDescriptor getConverterDescription(FacesContext context, Converter converter) {
+ public ConverterDescriptor getConverterDescription(FacesContext context, EditableValueHolder input, Converter converter) {
// determine converter message.
- FacesMessage message = getMessage(context, converter);
+ FacesMessage message = getMessage(context, converter, input);
ConverterDescriptorImpl descriptor = new ConverterDescriptorImpl(converter.getClass(), message);
fillParameters(descriptor, converter);
descriptor.makeImmutable();
Modified: branches/4.0.0.CR1/ui/validator/ui/src/main/java/org/richfaces/validator/FacesServiceBase.java
===================================================================
--- branches/4.0.0.CR1/ui/validator/ui/src/main/java/org/richfaces/validator/FacesServiceBase.java 2011-02-25 20:30:06 UTC (rev 21942)
+++ branches/4.0.0.CR1/ui/validator/ui/src/main/java/org/richfaces/validator/FacesServiceBase.java 2011-02-25 20:48:14 UTC (rev 21943)
@@ -7,6 +7,8 @@
import java.lang.reflect.InvocationTargetException;
import javax.faces.application.FacesMessage;
+import javax.faces.component.EditableValueHolder;
+import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import com.google.common.collect.ImmutableSet;
@@ -50,11 +52,23 @@
*
* @param context
* @param component
+ * @param input TODO
* @return
*/
- public FacesMessage getMessage(FacesContext context, T component) {
+ public FacesMessage getMessage(FacesContext context, T component, EditableValueHolder input) {
String messageId = getMessageId(component);
return MessageFactory.createMessage(context, messageId);
}
+
+ protected void setLabelParameter(EditableValueHolder input, FacesValidatorDescriptor descriptor) {
+ if (input instanceof UIComponent) {
+ UIComponent component = (UIComponent) input;
+ Object label = component.getAttributes().get("label");
+ if(null!=label){
+ descriptor.addParameter("label", label);
+ }
+ }
+ }
+
}
\ No newline at end of file
Modified: branches/4.0.0.CR1/ui/validator/ui/src/main/java/org/richfaces/validator/FacesValidatorServiceImpl.java
===================================================================
--- branches/4.0.0.CR1/ui/validator/ui/src/main/java/org/richfaces/validator/FacesValidatorServiceImpl.java 2011-02-25 20:30:06 UTC (rev 21942)
+++ branches/4.0.0.CR1/ui/validator/ui/src/main/java/org/richfaces/validator/FacesValidatorServiceImpl.java 2011-02-25 20:48:14 UTC (rev 21943)
@@ -4,6 +4,7 @@
package org.richfaces.validator;
import javax.faces.application.FacesMessage;
+import javax.faces.component.EditableValueHolder;
import javax.faces.component.UIInput;
import javax.faces.context.FacesContext;
import javax.faces.validator.DoubleRangeValidator;
@@ -19,15 +20,20 @@
*/
public class FacesValidatorServiceImpl extends FacesServiceBase<Validator> implements FacesValidatorService {
+ private static final String PATTERN = "pattern";
+ private static final String MINIMUM = "min";
+ private static final String MAXIMUM = "max";
+
/*
* (non-Javadoc)
*
* @see org.richfaces.validator.FacesValidatorService#getValidatorDescription(javax.faces.context.FacesContext,
* javax.faces.validator.Validator)
*/
- public ValidatorDescriptor getValidatorDescription(FacesContext context, Validator validator) {
- FacesMessage message = getMessage(context, validator);
+ public ValidatorDescriptor getValidatorDescription(FacesContext context, EditableValueHolder input, Validator validator) {
+ FacesMessage message = getMessage(context, validator, input);
FacesValidatorDescriptor descriptor = new FacesValidatorDescriptor(validator.getClass(), message);
+ setLabelParameter(input, descriptor);
fillParameters(descriptor, validator);
descriptor.makeImmutable();
return descriptor;
@@ -39,7 +45,7 @@
String messageId;
if (component instanceof DoubleRangeValidator) {
DoubleRangeValidator validator = (DoubleRangeValidator) component;
- if(validator.getMaximum() > Double.MIN_VALUE){
+ if(validator.getMaximum() < Double.MAX_VALUE){
if(validator.getMinimum()> Double.MIN_VALUE){
messageId = DoubleRangeValidator.NOT_IN_RANGE_MESSAGE_ID;
} else {
@@ -65,13 +71,13 @@
}
} else if (component instanceof LongRangeValidator) {
LongRangeValidator validator = (LongRangeValidator) component;
- if(validator.getMaximum() >0){
- if(validator.getMinimum()>0){
+ if(validator.getMaximum() !=0){
+ if(validator.getMinimum()!=0){
messageId = DoubleRangeValidator.NOT_IN_RANGE_MESSAGE_ID;
} else {
messageId = LongRangeValidator.MAXIMUM_MESSAGE_ID;
}
- } else if( validator.getMinimum()>0){
+ } else if( validator.getMinimum()!=0){
messageId = LongRangeValidator.MINIMUM_MESSAGE_ID;
} else {
messageId = DoubleRangeValidator.NOT_IN_RANGE_MESSAGE_ID;// What to use for that case ( no min/max set, validator always pass ).
@@ -86,4 +92,40 @@
return messageId;
}
+ @Override
+ protected void fillParameters(BaseFacesObjectDescriptor<Validator> descriptor, Validator component) {
+ if (component instanceof DoubleRangeValidator) {
+ DoubleRangeValidator validator = (DoubleRangeValidator) component;
+ if(validator.getMaximum() < Double.MAX_VALUE){
+ descriptor.addParameter(MAXIMUM, validator.getMaximum());
+ }
+ if( validator.getMinimum()>Double.MIN_VALUE){
+ descriptor.addParameter(MINIMUM, validator.getMinimum());
+ }
+ } else if (component instanceof LengthValidator) {
+ LengthValidator validator = (LengthValidator) component;
+ if(validator.getMaximum() >0){
+ descriptor.addParameter(MAXIMUM, validator.getMaximum());
+ }
+ if( validator.getMinimum()>0){
+ descriptor.addParameter(MINIMUM, validator.getMinimum());
+ }
+ } else if (component instanceof LongRangeValidator) {
+ LongRangeValidator validator = (LongRangeValidator) component;
+ if(validator.getMaximum() !=0){
+ descriptor.addParameter(MAXIMUM, validator.getMaximum());
+ }
+ if( validator.getMinimum()!=0){
+ descriptor.addParameter(MINIMUM, validator.getMinimum());
+ }
+ } else if (component instanceof RegexValidator) {
+ RegexValidator validator = (RegexValidator) component;
+ descriptor.addParameter(PATTERN, validator.getPattern());
+ } else if (component instanceof RequiredValidator) {
+ // do nothing.
+ } else {
+ super.fillParameters(descriptor, component);
+ }
+
+ }
}
Modified: branches/4.0.0.CR1/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/richfaces-csv.js
===================================================================
--- branches/4.0.0.CR1/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/richfaces-csv.js 2011-02-25 20:30:06 UTC (rev 21942)
+++ branches/4.0.0.CR1/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/richfaces-csv.js 2011-02-25 20:48:14 UTC (rev 21943)
@@ -36,6 +36,12 @@
return value;
}
+ var getLabel = function(component,id){
+ if(component.p){
+ return component.p.label || id;
+ }
+ return id;
+ }
$.extend(rf.csv, {
RE_DIGITS: /^-?\d+$/,
@@ -63,9 +69,10 @@
var converter = params.c;
rf.csv.clearMessage(id);
if (converter) {
+ var label=getLabel(converter,id);
try {
if (converter.f)
- convertedValue = converter.f(value,id,converter.p,converter.m);
+ convertedValue = converter.f(value,id,getLabel(converter,id),converter.m);
} catch (e){
e.severity=2;
rf.csv.sendMessage(id, e);
@@ -76,12 +83,13 @@
}
var validators = params.v;
if (validators) {
- var validatorFunction;
+ var validatorFunction,validator;
try {
for (i=0;i<validators.length;i++) {
- validatorFunction = validators[i].f;
+ validator=validators[i];
+ validatorFunction = validator.f;
if (validatorFunction) {
- validatorFunction(convertedValue,id, validators[i].p,validators[i].m);
+ validatorFunction(convertedValue,getLabel(validator,id), validator.p,validator.m);
}
}
} catch (e) {
@@ -164,14 +172,14 @@
});
var validateRange = function(value,label,params,msg) {
- var isMinSet = typeof params.minimum === "number" ;//&& params.minimum >0;
- var isMaxSet = typeof params.maximum === "number" ;//&& params.maximum >0;
+ var isMinSet = typeof params.min === "number" ;//&& params.min >0;
+ var isMaxSet = typeof params.max === "number" ;//&& params.max >0;
- if (isMaxSet && value > params.maximum) {
- throw rf.csv.interpolateMessage(msg,isMinSet?[params.minimum,params.maximum,label]:[params.maximum,label]);
+ if (isMaxSet && value > params.max) {
+ throw rf.csv.interpolateMessage(msg,isMinSet?[params.min,params.max,label]:[params.max,label]);
}
- if (isMinSet && value < params.minimum) {
- throw rf.csv.interpolateMessage(msg,isMaxSet?[params.minimum,params.maximum,label]:[params.minimum,label]);
+ if (isMinSet && value < params.min) {
+ throw rf.csv.interpolateMessage(msg,isMaxSet?[params.min,params.max,label]:[params.min,label]);
}
};
@@ -231,7 +239,7 @@
},
"validateSize": function (value,label,params,msg) {
var length = value?value.length:0;
- validateRange(length,label,{maximum:params.max,minimum:params.min},msg);
+ validateRange(length,label,params,msg);
},
"validateRegex": function (value,label,params,msg) {
validateRegex(value,label,params.pattern,msg);
Modified: branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorGetConverterTest.java
===================================================================
--- branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorGetConverterTest.java 2011-02-25 20:30:06 UTC (rev 21942)
+++ branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorGetConverterTest.java 2011-02-25 20:48:14 UTC (rev 21943)
@@ -45,7 +45,7 @@
public void setupService() {
expect(factory.getInstance(FacesConverterService.class)).andStubReturn(converterService);
converterCapture = new Capture<Converter>();
- expect(converterService.getConverterDescription(eq(environment.getFacesContext()), capture(converterCapture)))
+ expect(converterService.getConverterDescription(same(environment.getFacesContext()), same(input), capture(converterCapture)))
.andStubReturn(descriptor);
ServiceTracker.setFactory(factory);
}
Modified: branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorGetValidatorTest.java
===================================================================
--- branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorGetValidatorTest.java 2011-02-25 20:30:06 UTC (rev 21942)
+++ branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorGetValidatorTest.java 2011-02-25 20:48:14 UTC (rev 21943)
@@ -107,7 +107,7 @@
ValidatorDescriptor validatorDescriptor = environment.createMock(ValidatorDescriptor.class);
expect((Class) validatorDescriptor.getImplementationClass()).andStubReturn(validator.getClass());
expect(validatorDescriptor.getMessage()).andStubReturn(VALIDATION_ERROR);
- expect(facesValidatorService.getValidatorDescription(environment.getFacesContext(), validator))
+ expect(facesValidatorService.getValidatorDescription(environment.getFacesContext(), input, validator))
.andStubReturn(validatorDescriptor);
}
}
Modified: branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/MockTestBase.java
===================================================================
--- branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/MockTestBase.java 2011-02-25 20:30:06 UTC (rev 21942)
+++ branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/MockTestBase.java 2011-02-25 20:48:14 UTC (rev 21943)
@@ -7,7 +7,7 @@
import java.util.Locale;
import java.util.Map;
-import javax.faces.component.UIComponent;
+import javax.faces.component.UIInput;
import javax.faces.component.UIViewRoot;
import org.jboss.test.faces.mock.MockFacesEnvironment;
@@ -32,7 +32,7 @@
protected final RunParameters criteria;
protected MockFacesEnvironment facesEnvironment;
- protected UIComponent component;
+ protected UIInput input;
public MockTestBase(RunParameters criteria) {
this.criteria = criteria;
@@ -42,7 +42,7 @@
@Before
public void setUp() {
this.facesEnvironment = MockFacesEnvironment.createEnvironment().withApplication().resetToNice();
- component = facesEnvironment.createMock(UIComponent.class);
+ input = facesEnvironment.createMock(UIInput.class);
recordMocks();
facesEnvironment.replay();
}
@@ -51,8 +51,8 @@
UIViewRoot viewRoot = facesEnvironment.createMock(UIViewRoot.class);
expect(viewRoot.getLocale()).andStubReturn(Locale.ENGLISH);
expect(facesEnvironment.getFacesContext().getViewRoot()).andStubReturn(viewRoot);
- expect(component.getAttributes()).andStubReturn(Collections.EMPTY_MAP);
- expect(component.getClientId(facesEnvironment.getFacesContext())).andStubReturn(TEST_COMPONENT_ID);
+ expect(input.getAttributes()).andStubReturn(Collections.EMPTY_MAP);
+ expect(input.getClientId(facesEnvironment.getFacesContext())).andStubReturn(TEST_COMPONENT_ID);
}
@After
Modified: branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/converter/ByteConverterTest.java
===================================================================
--- branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/converter/ByteConverterTest.java 2011-02-25 20:30:06 UTC (rev 21942)
+++ branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/converter/ByteConverterTest.java 2011-02-25 20:48:14 UTC (rev 21943)
@@ -5,7 +5,6 @@
import java.util.List;
-import javax.faces.convert.BooleanConverter;
import javax.faces.convert.ByteConverter;
import javax.faces.convert.Converter;
Modified: branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/converter/ConverterTestBase.java
===================================================================
--- branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/converter/ConverterTestBase.java 2011-02-25 20:30:06 UTC (rev 21942)
+++ branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/converter/ConverterTestBase.java 2011-02-25 20:48:14 UTC (rev 21943)
@@ -1,13 +1,10 @@
package org.richfaces.javascript.client.converter;
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertTrue;
import static org.junit.Assert.*;
import javax.faces.application.FacesMessage;
import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;
-import javax.faces.validator.Validator;
import net.sourceforge.htmlunit.corejs.javascript.JavaScriptException;
import net.sourceforge.htmlunit.corejs.javascript.NativeObject;
@@ -33,7 +30,7 @@
Converter converter = createConverter();
try {
Object convertedValue =
- converter.getAsObject(facesEnvironment.getFacesContext(), component, criteria.getValue().toString());
+ converter.getAsObject(facesEnvironment.getFacesContext(), input, criteria.getValue().toString());
Object jsConvertedValue =
convertOnClient(converter);
if(null != convertedValue || null != jsConvertedValue){
@@ -66,7 +63,7 @@
private Object getErrorMessage(Converter converter) {
ConverterServiceImpl converterService = new ConverterServiceImpl();
- FacesMessage message = converterService.getMessage(facesEnvironment.getFacesContext(), converter);
+ FacesMessage message = converterService.getMessage(facesEnvironment.getFacesContext(), converter, input);
return new Message(message);
}
Modified: branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/converter/NumberConverterTest.java
===================================================================
--- branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/converter/NumberConverterTest.java 2011-02-25 20:30:06 UTC (rev 21942)
+++ branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/converter/NumberConverterTest.java 2011-02-25 20:48:14 UTC (rev 21943)
@@ -4,7 +4,6 @@
import java.util.List;
import java.util.Map;
-import javax.faces.convert.BooleanConverter;
import javax.faces.convert.NumberConverter;
import javax.faces.convert.Converter;
Modified: branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/converter/ShortConverterTest.java
===================================================================
--- branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/converter/ShortConverterTest.java 2011-02-25 20:30:06 UTC (rev 21942)
+++ branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/converter/ShortConverterTest.java 2011-02-25 20:48:14 UTC (rev 21943)
@@ -1,11 +1,8 @@
package org.richfaces.javascript.client.converter;
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertTrue;
import java.util.List;
-import javax.faces.convert.BooleanConverter;
import javax.faces.convert.ShortConverter;
import javax.faces.convert.Converter;
Modified: branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/DoubleRangeValidatorTest.java
===================================================================
--- branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/DoubleRangeValidatorTest.java 2011-02-25 20:30:06 UTC (rev 21942)
+++ branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/DoubleRangeValidatorTest.java 2011-02-25 20:48:14 UTC (rev 21943)
@@ -18,8 +18,8 @@
*/
public class DoubleRangeValidatorTest extends ValidatorTestBase {
- private static final String MINIMUM = "minimum";
- private static final String MAXIMUM = "maximum";
+ private static final String MINIMUM = "min";
+ private static final String MAXIMUM = "max";
/**
* @param criteria
*/
Modified: branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/LengthValidatorTest.java
===================================================================
--- branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/LengthValidatorTest.java 2011-02-25 20:30:06 UTC (rev 21942)
+++ branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/LengthValidatorTest.java 2011-02-25 20:48:14 UTC (rev 21943)
@@ -18,8 +18,8 @@
*/
public class LengthValidatorTest extends ValidatorTestBase {
- private static final String MINIMUM = "minimum";
- private static final String MAXIMUM = "maximum";
+ private static final String MINIMUM = "min";
+ private static final String MAXIMUM = "max";
/**
* @param criteria
*/
Modified: branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/LongRangeValidatorTest.java
===================================================================
--- branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/LongRangeValidatorTest.java 2011-02-25 20:30:06 UTC (rev 21942)
+++ branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/LongRangeValidatorTest.java 2011-02-25 20:48:14 UTC (rev 21943)
@@ -18,8 +18,8 @@
*/
public class LongRangeValidatorTest extends ValidatorTestBase {
- private static final String MINIMUM = "minimum";
- private static final String MAXIMUM = "maximum";
+ private static final String MINIMUM = "min";
+ private static final String MAXIMUM = "max";
/**
* @param criteria
*/
Modified: branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/MaxValidatorTest.java
===================================================================
--- branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/MaxValidatorTest.java 2011-02-25 20:30:06 UTC (rev 21942)
+++ branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/MaxValidatorTest.java 2011-02-25 20:48:14 UTC (rev 21943)
@@ -4,10 +4,7 @@
package org.richfaces.javascript.client.validator;
import java.util.List;
-import java.util.Map;
-import javax.faces.validator.LengthValidator;
-import javax.faces.validator.Validator;
import javax.validation.constraints.Max;
import org.junit.runners.Parameterized.Parameters;
@@ -38,9 +35,8 @@
@Parameters
public static List<RunParameters[]> parameters() {
- return options(
- pass(0,PROP,"number",MAXIMUM,2),pass(2,PROP,"number",MAXIMUM,2),pass(123,PROP,"number",MAXIMUM,2)
- );
+ return options(pass(0, PROP, "number", MAXIMUM, 2), pass(2, PROP, "number", MAXIMUM, 2),
+ pass(123, PROP, "number", MAXIMUM, 2));
}
public static final class Bean {
Modified: branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/ValidatorTestBase.java
===================================================================
--- branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/ValidatorTestBase.java 2011-02-25 20:30:06 UTC (rev 21942)
+++ branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/ValidatorTestBase.java 2011-02-25 20:48:14 UTC (rev 21943)
@@ -49,7 +49,7 @@
public void testValidator() throws Exception {
Validator validator = createValidator();
try {
- validator.validate(facesEnvironment.getFacesContext(), component, criteria.getValue());
+ validator.validate(facesEnvironment.getFacesContext(), input, criteria.getValue());
validateOnClient(validator);
} catch (ValidatorException e) {
// client-side script has to throw exception too.
@@ -80,7 +80,7 @@
private Object getErrorMessage(Validator validator) {
FacesValidatorServiceImpl validatorService = new FacesValidatorServiceImpl();
- FacesMessage message = validatorService.getMessage(facesEnvironment.getFacesContext(), validator);
+ FacesMessage message = validatorService.getMessage(facesEnvironment.getFacesContext(), validator, input);
return new Message(message);
}
Modified: branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/validator/FacesConverterServiceTest.java
===================================================================
--- branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/validator/FacesConverterServiceTest.java 2011-02-25 20:30:06 UTC (rev 21942)
+++ branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/validator/FacesConverterServiceTest.java 2011-02-25 20:48:14 UTC (rev 21943)
@@ -70,7 +70,7 @@
public void getConverterClass() throws Exception {
converter = new BooleanConverter();
controller.replay();
- ConverterDescriptor converterDescription = serviceImpl.getConverterDescription(environment.getFacesContext(), converter);
+ ConverterDescriptor converterDescription = serviceImpl.getConverterDescription(environment.getFacesContext(), input, converter);
assertEquals(converter.getClass(), converterDescription.getImplementationClass());
}
@@ -85,7 +85,7 @@
facesMessage = e.getFacesMessage();
}
assertNotNull(facesMessage);
- ConverterDescriptor converterDescription = serviceImpl.getConverterDescription(environment.getFacesContext(), converter);
+ ConverterDescriptor converterDescription = serviceImpl.getConverterDescription(environment.getFacesContext(), input, converter);
String summary = converterDescription.getMessage().getSummary();
summary = summary.replace("{2}", "foo");
summary = summary.replace("'{0}'", "abc");
@@ -102,7 +102,7 @@
converter.setType("both");
converter.setTimeZone(TimeZone.getTimeZone("EST"));
controller.replay();
- ConverterDescriptor converterDescription = serviceImpl.getConverterDescription(environment.getFacesContext(), converter);
+ ConverterDescriptor converterDescription = serviceImpl.getConverterDescription(environment.getFacesContext(), input, converter);
Map<String, ? extends Object> additionalParameters = converterDescription.getAdditionalParameters();
assertEquals("short", additionalParameters.get("dateStyle"));
assertEquals("MM/DD/YYYY", additionalParameters.get("pattern"));
Modified: branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/validator/FacesValidatorServiceTest.java
===================================================================
--- branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/validator/FacesValidatorServiceTest.java 2011-02-25 20:30:06 UTC (rev 21942)
+++ branches/4.0.0.CR1/ui/validator/ui/src/test/java/org/richfaces/validator/FacesValidatorServiceTest.java 2011-02-25 20:48:14 UTC (rev 21943)
@@ -65,7 +65,7 @@
public void getConverterClass() throws Exception {
validator = new LengthValidator();
controller.replay();
- ValidatorDescriptor validatorDescription = serviceImpl.getValidatorDescription(environment.getFacesContext(), validator);
+ ValidatorDescriptor validatorDescription = serviceImpl.getValidatorDescription(environment.getFacesContext(), input, validator);
assertEquals(validator.getClass(), validatorDescription.getImplementationClass());
}
@@ -80,7 +80,7 @@
facesMessage = e.getFacesMessage();
}
assertNotNull(facesMessage);
- ValidatorDescriptor validatorDescription = serviceImpl.getValidatorDescription(environment.getFacesContext(), validator);
+ ValidatorDescriptor validatorDescription = serviceImpl.getValidatorDescription(environment.getFacesContext(), input, validator);
String summary = validatorDescription.getMessage().getSummary();
summary = summary.replace("{0}", "foo");
assertEquals(facesMessage.getSummary(), summary);
13 years, 2 months
JBoss Rich Faces SVN: r21942 - in branches/4.0.0.CR1: examples/input-demo/src/main/java/org/richfaces/demo/autocomplete and 5 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2011-02-25 15:30:06 -0500 (Fri, 25 Feb 2011)
New Revision: 21942
Added:
branches/4.0.0.CR1/examples/input-demo/src/main/java/org/richfaces/demo/autocomplete/
branches/4.0.0.CR1/examples/input-demo/src/main/java/org/richfaces/demo/autocomplete/AutoCompleteBean.java
branches/4.0.0.CR1/examples/input-demo/src/main/java/org/richfaces/demo/autocomplete/AutocompleteBeanConverter.java
branches/4.0.0.CR1/examples/input-demo/src/main/webapp/examples/autocompleteConverter.xhtml
Removed:
branches/4.0.0.CR1/examples/input-demo/src/main/java/org/richfaces/demo/AutoCompleteBean.java
Modified:
branches/4.0.0.CR1/examples/input-demo/src/main/webapp/examples/autocomplete.xhtml
branches/4.0.0.CR1/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java
branches/4.0.0.CR1/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java
branches/4.0.0.CR1/ui/input/ui/src/main/java/org/richfaces/view/facelets/AutocompleteHandler.java
branches/4.0.0.CR1/ui/input/ui/src/main/templates/autocomplete.template.xml
Log:
RF-10614: @converter attribute is fixed, @itemConverter is removed
Deleted: branches/4.0.0.CR1/examples/input-demo/src/main/java/org/richfaces/demo/AutoCompleteBean.java
===================================================================
--- branches/4.0.0.CR1/examples/input-demo/src/main/java/org/richfaces/demo/AutoCompleteBean.java 2011-02-25 19:32:28 UTC (rev 21941)
+++ branches/4.0.0.CR1/examples/input-demo/src/main/java/org/richfaces/demo/AutoCompleteBean.java 2011-02-25 20:30:06 UTC (rev 21942)
@@ -1,110 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces.demo;
-
-import java.io.Serializable;
-import java.util.Locale;
-
-import javax.faces.bean.ManagedBean;
-import javax.faces.bean.ManagedProperty;
-import javax.faces.bean.SessionScoped;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-
-import org.richfaces.component.AutocompleteMode;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Collections2;
-
-/**
- * @author Nick Belaevski
- *
- */
-@ManagedBean
-@SessionScoped
-public class AutoCompleteBean implements Serializable {
-
- private static final long serialVersionUID = 3072125097847582809L;
-
- private class CountryNamePredicate implements Predicate<Country> {
-
- private String countryNamePrefix;
-
- public CountryNamePredicate(String countryNamePrefix) {
- super();
- this.countryNamePrefix = countryNamePrefix;
- }
-
- public boolean apply(Country input) {
- if (countryNamePrefix == null || countryNamePrefix.length() == 0) {
- return true;
- }
-
- return input.getName().toLowerCase(Locale.US).startsWith(countryNamePrefix);
- }
- }
-
- private String value;
-
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public String getValue() {
- return value;
- }
-
- private AutocompleteMode mode = AutocompleteMode.lazyClient;
-
- public AutocompleteMode getMode() {
- return mode;
- }
-
- public void setMode(AutocompleteMode mode) {
- this.mode = mode;
- }
-
- @ManagedProperty(value = "#{countriesBean}")
- private CountriesBean countriesBean;
-
- public void setCountriesBean(CountriesBean countriesBean) {
- this.countriesBean = countriesBean;
- }
-
- public Object autocomplete(FacesContext facesContext, UIComponent component, String value) {
- // for tests when value does not starts with prefix
- /*String str = value;
- if (str.charAt(0)=='i') {
- str = str.substring(1);
- }*/
-
- AutocompleteMode mode = (AutocompleteMode) component.getAttributes().get("mode");
- boolean isClient = mode == AutocompleteMode.client || mode == AutocompleteMode.lazyClient;
- String v = isClient ? "" : value;
- return Collections2.filter(countriesBean.getCountries(), new CountryNamePredicate(v.toLowerCase(Locale.US)));
- }
-
- public Object getModes() {
- return AutocompleteMode.values();
- }
-}
Added: branches/4.0.0.CR1/examples/input-demo/src/main/java/org/richfaces/demo/autocomplete/AutoCompleteBean.java
===================================================================
--- branches/4.0.0.CR1/examples/input-demo/src/main/java/org/richfaces/demo/autocomplete/AutoCompleteBean.java (rev 0)
+++ branches/4.0.0.CR1/examples/input-demo/src/main/java/org/richfaces/demo/autocomplete/AutoCompleteBean.java 2011-02-25 20:30:06 UTC (rev 21942)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.demo.autocomplete;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Collections2;
+import org.richfaces.component.AutocompleteMode;
+import org.richfaces.demo.CountriesBean;
+import org.richfaces.demo.Country;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ManagedProperty;
+import javax.faces.bean.SessionScoped;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import java.io.Serializable;
+import java.util.Locale;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@ManagedBean
+@SessionScoped
+public class AutoCompleteBean implements Serializable {
+
+ private static final long serialVersionUID = 3072125097847582809L;
+
+ private class CountryNamePredicate implements Predicate<Country> {
+
+ private String countryNamePrefix;
+
+ public CountryNamePredicate(String countryNamePrefix) {
+ super();
+ this.countryNamePrefix = countryNamePrefix;
+ }
+
+ public boolean apply(Country input) {
+ if (countryNamePrefix == null || countryNamePrefix.length() == 0) {
+ return true;
+ }
+
+ return input.getName().toLowerCase(Locale.US).startsWith(countryNamePrefix);
+ }
+ }
+
+ private Object value;
+
+
+ public void setValue(Object value) {
+ this.value = value;
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ private AutocompleteMode mode = AutocompleteMode.lazyClient;
+
+ public AutocompleteMode getMode() {
+ return mode;
+ }
+
+ public void setMode(AutocompleteMode mode) {
+ this.mode = mode;
+ }
+
+ @ManagedProperty(value = "#{countriesBean}")
+ private CountriesBean countriesBean;
+
+ public void setCountriesBean(CountriesBean countriesBean) {
+ this.countriesBean = countriesBean;
+ }
+
+ public Object autocomplete(FacesContext facesContext, UIComponent component, String value) {
+ AutocompleteMode mode = (AutocompleteMode) component.getAttributes().get("mode");
+ boolean isClient = mode == AutocompleteMode.client || mode == AutocompleteMode.lazyClient;
+ String v = isClient || value ==null ? "" : value;
+
+ return Collections2.filter(countriesBean.getCountries(), new CountryNamePredicate(v.toLowerCase(Locale.US)));
+ }
+
+ public Object getModes() {
+ return AutocompleteMode.values();
+ }
+}
Added: branches/4.0.0.CR1/examples/input-demo/src/main/java/org/richfaces/demo/autocomplete/AutocompleteBeanConverter.java
===================================================================
--- branches/4.0.0.CR1/examples/input-demo/src/main/java/org/richfaces/demo/autocomplete/AutocompleteBeanConverter.java (rev 0)
+++ branches/4.0.0.CR1/examples/input-demo/src/main/java/org/richfaces/demo/autocomplete/AutocompleteBeanConverter.java 2011-02-25 20:30:06 UTC (rev 21942)
@@ -0,0 +1,47 @@
+package org.richfaces.demo.autocomplete;
+
+import org.richfaces.demo.CountriesBean;
+import org.richfaces.demo.Country;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.FacesConverter;
+import java.io.Serializable;
+
+@FacesConverter(value = "autocompleteBeanConverter")
+public class AutocompleteBeanConverter implements Converter, Serializable {
+
+ public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String value) {
+ System.out.println("AutocompleteBeanConverter#getAsObject is called");
+ if (value == null || value.equals("")) {
+ return null;
+ } else {
+ CountriesBean countriesBean = (CountriesBean) FacesContext.getCurrentInstance().getExternalContext().getApplicationMap().get("countriesBean");
+ for (Country country : countriesBean.getCountries()) {
+ if (country.getName().equals(value)) {
+ return country;
+ }
+ }
+
+ return null;
+ }
+ }
+
+ public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object value) {
+ System.out.println("AutocompleteBeanConverter#getAsString is called");
+ if (value != null) {
+ Country bean;
+ try {
+ bean = (Country) value;
+ return bean.getName();
+ } catch (ClassCastException e) {
+ System.out.println("Cannot cast " + value + "to Country");
+ return null;
+ }
+ } else {
+ return null;
+ }
+ }
+
+}
\ No newline at end of file
Modified: branches/4.0.0.CR1/examples/input-demo/src/main/webapp/examples/autocomplete.xhtml
===================================================================
--- branches/4.0.0.CR1/examples/input-demo/src/main/webapp/examples/autocomplete.xhtml 2011-02-25 19:32:28 UTC (rev 21941)
+++ branches/4.0.0.CR1/examples/input-demo/src/main/webapp/examples/autocomplete.xhtml 2011-02-25 20:30:06 UTC (rev 21942)
@@ -1,183 +1,294 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:input="http://richfaces.org/input"
- xmlns:output="http://richfaces.org/output"
- xmlns:rich="http://richfaces.org/iteration"
- xmlns:misc="http://richfaces.org/misc"
- xmlns:a4j="http://richfaces.org/a4j">
-<f:view contentType="text/html" />
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:input="http://richfaces.org/input"
+ xmlns:output="http://richfaces.org/output"
+ xmlns:rich="http://richfaces.org/iteration"
+ xmlns:misc="http://richfaces.org/misc"
+ xmlns:a4j="http://richfaces.org/a4j">
+<f:view contentType="text/html"/>
<h:head>
- <title>Richfaces Autocomplete</title>
+ <title>Richfaces Autocomplete</title>
</h:head>
<h:body style="margin: 30px;">
<ui:composition template="/templates/template.xhtml">
- <ui:define name="title">Autocomplete Example</ui:define>
- <ui:define name="body_head">Autocomplete Example</ui:define>
+<ui:define name="title">Autocomplete Example</ui:define>
+<ui:define name="body_head">Autocomplete Example</ui:define>
- <ui:define name="body">
-
- <style type="text/css">
- .myPopupClass .rf-au-lst-scrl {
- border: 1px solid red;
- width: 400px;
- }
- </style>
+<ui:define name="body">
+<style type="text/css">
+ .myPopupClass .rf-au-lst-scrl {
+ border: 1px solid red;
+ width: 400px;
+ }
+</style>
- <h:form id="form">
- <h:selectOneMenu value="#{autoCompleteBean.mode}" onchange="submit()">
- <f:selectItems value="#{autoCompleteBean.modes}" />
- </h:selectOneMenu><br/>
- <div style="height: 300px; width: 300px; overflow: auto; float:left;">Text
- block text block text block text block text block text block text
- block text block
- <script type="text/javascript">
- function customFilterFunction(subString, value) {
- if(subString.length>1)
- if(value.indexOf(subString)!=-1) return true;
- }
- </script>
+<h:form id="form">
+ <h:selectOneMenu value="#{autoCompleteBean.mode}" onchange="submit()">
+ <f:selectItems value="#{autoCompleteBean.modes}"/>
+ </h:selectOneMenu><br/>
- <input:autocomplete popupClass="myPopupClass" autofill="false" id="myAutocomplete" clientFilterFunction="customFilterFunction" mode="#{autoCompleteBean.mode}" minChars="2" autocompleteMethod="#{autoCompleteBean.autocomplete}" var="country" fetchValue="#{country.name}" showButton="true"
- value = "#{autoCompleteBean.value}" layout="list"
- onchange="return onEvent.call(this, event);" onselectitem="return onEvent.call(this, event);" onblur="return onEvent.call(this, event);" onfocus="return onEvent.call(this, event);">
- #{country.name} #{country.iso} #{country.domain}
- <a4j:ajax event="change" render="output"/>
- </input:autocomplete>
- <br /><h:outputText value="RF-9835:" /><br />
- <input:autocomplete id="myAutocomplete1" mode="client" autocompleteMethod="#{autoCompleteBean.autocomplete}" var="country" fetchValue="#{country.name}" showButton="true"
- value = "#{autoCompleteBean.value}" layout="table">
- <rich:column>
- <h:outputText value="#{country.name}" />
- </rich:column>
- <rich:column>
- <h:outputText value="#{country.iso}" />
- </rich:column>
- <rich:column>
- <h:outputText value="#{country.domain}" />
- </rich:column>
- <a4j:ajax event="change" render="output"/>
- </input:autocomplete>
- <br/><br/>
- Your selection: <h:outputText id="output" value="#{autoCompleteBean.value}"/>
- <script type="text/javascript">
- onEvent = function(event, element, data){
- RichFaces.log.info("jQuery Event: "+(event instanceof jQuery.Event)+"; event: "+event.type+"; data:"+(data || (event['rich']||{})['data'])+"; this.id:"+this.id+"; component:"+ (event['rich']||{})['component']||RichFaces.$(this.id));
- };
- RichFaces.Event.bindById("form:myAutocomplete", "selectitem change blur focus", onEvent);
- </script>
- <br />
- <select style="width: 200px" name="select">
- <option>option 0</option><option>option 1</option><option>option 2</option><option>option 3</option><option>option 4</option><option>option 5</option><option>option 6</option><option>option 7</option><option>option 8</option><option>option 9</option><option>option 10</option><option>option 11</option><option>option 12</option><option>option 13</option><option>option 14</option><option>option 15</option><option>option 16</option><option>option 17</option><option>option 18</option><option>option 19</option><option>option 20</option><option>option 21</option><option>option 22</option><option>option 23</option><option>option 24</option><option>option 25</option><option>option 26</option><option>option 27</option><option>option 28</option><option>option 29</option><option>option 30</option><option>option 31</option><option>option 32</option><option>option 33</option><option>option 34</option><option>option 35</option><option>option 36</option><option>option 37</option><option!
>option 38</option><option>option 39</option><option>option 40</option><option>option 41</option><option>option 42</option><option>option 43</option><option>option 44</option><option>option 45</option><option>option 46</option><option>option 47</option><option>option 48</option><option>option 49</option><option>option 50</option><option>option 51</option><option>option 52</option><option>option 53</option><option>option 54</option><option>option 55</option><option>option 56</option><option>option 57</option><option>option 58</option><option>option 59</option><option>option 60</option><option>option 61</option><option>option 62</option><option>option 63</option><option>option 64</option><option>option 65</option><option>option 66</option><option>option 67</option><option>option 68</option><option>option 69</option><option>option 70</option><option>option 71</option><option>option 72</option><option>option 73</option><option>option 74</option><option>option 75</option><option!
>option 76</option><option>option 77</option><option>option 78!
</option
><option>option 79</option><option>option 80</option><option>option 81</option><option>option 82</option><option>option 83</option><option>option 84</option><option>option 85</option><option>option 86</option><option>option 87</option><option>option 88</option><option>option 89</option><option>option 90</option><option>option 91</option><option>option 92</option><option>option 93</option><option>option 94</option><option>option 95</option><option>option 96</option><option>option 97</option><option>option 98</option><option>option 99</option>
- </select> text block text block text block text block text block text
- block text block text block text block text block text block text
- block text block text block text block text block text block text
- block text block text block text block text block text block text
- block text block text block text block text block text block text
- block text block text block text block text block text block text
- block text block text block text block text block text block text
- block text block text block text block text block text block text
- block text block text block text block text block text block text
- block text block text block text block text block text block text
- block text block text block text block text block text block text
- block text block text block text block text block text block text
- block text block text block text block text block text block text
- block text block text block text block text block text block text
- block text block text block text block text block text block text
- block text block text block text block text block text block text
- block text block text block text block text block text block text
- block text block text block text block text block text block text
- block text block text block text block text block text block text
- block text block text block text block text block text block text
- block text block text block text block text block text block text
- block text block text block text block text block text block text
- block text block text block text block text block text block text
- block text block text block text block text block text block text
- block text block text block text block text block text block text
- block text block text block text block text block text block text
- block text block text block text block text block text block text
- block text block text block text block text block text block text
- block text block text block
- </div>
- <div>
- <a4j:log mode="inline"></a4j:log>
- </div>
- </h:form>
- <h:form>
- RF-9567:<br/><br/>
- <a4j:outputPanel ajaxRendered="true"><h:messages /></a4j:outputPanel>
-
-
- <input:autocomplete mode="ajax" id="autocomplete" autocompleteMethod="#{autoCompleteBean.autocomplete}" value="#{autoCompleteBean.value}">
- <f:validateRegex pattern="Alabama" />
- </input:autocomplete>
+ <div style="height: 300px; width: 300px; overflow: auto; float:left;">Text
+ block text block text block text block text block text block text
+ block text block
+ <script type="text/javascript">
+ function customFilterFunction(subString, value) {
+ if (subString.length > 1)
+ if (value.indexOf(subString) != -1) return true;
+ }
+ </script>
- <a4j:commandButton render="@form" execute="autocomplete" />
- </h:form>
- <h:form>
- <input:autocomplete mode="cachedAjax" tokens="," minChars="0"
-autofill="true" selectFirst="false" layout="table"
-autocompleteMethod="#{autoCompleteBean.autocomplete}" var="country" fetchValue="#{country.name}">
-<h:column>
-#{country.name}
-</h:column>
-<h:column>
-#{country.iso}
-</h:column>
-</input:autocomplete>
+ <input:autocomplete popupClass="myPopupClass" autofill="false" id="myAutocomplete"
+ clientFilterFunction="customFilterFunction" mode="#{autoCompleteBean.mode}"
+ minChars="2" autocompleteMethod="#{autoCompleteBean.autocomplete}" var="country"
+ fetchValue="#{country.name}" showButton="true"
+ value="#{autoCompleteBean.value}" layout="list"
+ onchange="return onEvent.call(this, event);"
+ onselectitem="return onEvent.call(this, event);"
+ onblur="return onEvent.call(this, event);"
+ onfocus="return onEvent.call(this, event);">
+ #{country.name} #{country.iso} #{country.domain}
+ <a4j:ajax event="change" render="output"/>
+ </input:autocomplete>
+ <br/><h:outputText value="RF-9835:"/><br/>
+ <input:autocomplete id="myAutocomplete1" mode="client"
+ autocompleteMethod="#{autoCompleteBean.autocomplete}" var="country"
+ fetchValue="#{country.name}" showButton="true"
+ value="#{autoCompleteBean.value}" layout="table">
+ <rich:column>
+ <h:outputText value="#{country.name}"/>
+ </rich:column>
+ <rich:column>
+ <h:outputText value="#{country.iso}"/>
+ </rich:column>
+ <rich:column>
+ <h:outputText value="#{country.domain}"/>
+ </rich:column>
+ <a4j:ajax event="change" render="output"/>
+ </input:autocomplete>
+ <br/><br/>
+ Your selection: <h:outputText id="output" value="#{autoCompleteBean.value}"/>
+ <script type="text/javascript">
+ onEvent = function(event, element, data) {
+ RichFaces.log.info("jQuery Event: " + (event instanceof jQuery.Event) + "; event: " + event.type + "; data:" + (data || (event['rich'] || {})['data']) + "; this.id:" + this.id + "; component:" + (event['rich'] || {})['component'] || RichFaces.$(this.id));
+ };
+ RichFaces.Event.bindById("form:myAutocomplete", "selectitem change blur focus", onEvent);
+ </script>
+ <br/>
+ <select style="width: 200px" name="select">
+ <option>option 0</option>
+ <option>option 1</option>
+ <option>option 2</option>
+ <option>option 3</option>
+ <option>option 4</option>
+ <option>option 5</option>
+ <option>option 6</option>
+ <option>option 7</option>
+ <option>option 8</option>
+ <option>option 9</option>
+ <option>option 10</option>
+ <option>option 11</option>
+ <option>option 12</option>
+ <option>option 13</option>
+ <option>option 14</option>
+ <option>option 15</option>
+ <option>option 16</option>
+ <option>option 17</option>
+ <option>option 18</option>
+ <option>option 19</option>
+ <option>option 20</option>
+ <option>option 21</option>
+ <option>option 22</option>
+ <option>option 23</option>
+ <option>option 24</option>
+ <option>option 25</option>
+ <option>option 26</option>
+ <option>option 27</option>
+ <option>option 28</option>
+ <option>option 29</option>
+ <option>option 30</option>
+ <option>option 31</option>
+ <option>option 32</option>
+ <option>option 33</option>
+ <option>option 34</option>
+ <option>option 35</option>
+ <option>option 36</option>
+ <option>option 37</option>
+ <option>option 38</option>
+ <option>option 39</option>
+ <option>option 40</option>
+ <option>option 41</option>
+ <option>option 42</option>
+ <option>option 43</option>
+ <option>option 44</option>
+ <option>option 45</option>
+ <option>option 46</option>
+ <option>option 47</option>
+ <option>option 48</option>
+ <option>option 49</option>
+ <option>option 50</option>
+ <option>option 51</option>
+ <option>option 52</option>
+ <option>option 53</option>
+ <option>option 54</option>
+ <option>option 55</option>
+ <option>option 56</option>
+ <option>option 57</option>
+ <option>option 58</option>
+ <option>option 59</option>
+ <option>option 60</option>
+ <option>option 61</option>
+ <option>option 62</option>
+ <option>option 63</option>
+ <option>option 64</option>
+ <option>option 65</option>
+ <option>option 66</option>
+ <option>option 67</option>
+ <option>option 68</option>
+ <option>option 69</option>
+ <option>option 70</option>
+ <option>option 71</option>
+ <option>option 72</option>
+ <option>option 73</option>
+ <option>option 74</option>
+ <option>option 75</option>
+ <option>option 76</option>
+ <option>option 77</option>
+ <option>option 78</option>
+ <option>option 79</option>
+ <option>option 80</option>
+ <option>option 81</option>
+ <option>option 82</option>
+ <option>option 83</option>
+ <option>option 84</option>
+ <option>option 85</option>
+ <option>option 86</option>
+ <option>option 87</option>
+ <option>option 88</option>
+ <option>option 89</option>
+ <option>option 90</option>
+ <option>option 91</option>
+ <option>option 92</option>
+ <option>option 93</option>
+ <option>option 94</option>
+ <option>option 95</option>
+ <option>option 96</option>
+ <option>option 97</option>
+ <option>option 98</option>
+ <option>option 99</option>
+ </select> text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block
+ </div>
+ <div>
+ <a4j:log mode="inline"></a4j:log>
+ </div>
</h:form>
- <h:form>
- <h:commandButton id="leggTilKontroll" value="Button">
- <misc:componentControl target="popup" operation="show" />
- </h:commandButton>
- </h:form>
- <output:popupPanel id="popup" autosized="true">
- <h:form>
- <input:autocomplete mode="cachedAjax" autocompleteMethod="#{autoCompleteBean.autocomplete}" var="country" fetchValue="#{country.name}">
- #{country.name} #{country.iso} #{country.domain}
- </input:autocomplete>
- <input:select id="select" enableManualInput="true" defaultLabel="Select Value ...">
- <f:selectItem itemLabel="Label#1" itemValue="Value#1"/>
- <f:selectItem itemLabel="Label#2" itemValue="Value#2"/>
- <f:selectItem itemLabel="Label#3" itemValue="Value#3"/>
- <f:selectItem itemLabel="Label#4" itemValue="Value#4"/>
- <f:selectItem itemLabel="Label#5" itemValue="Value#5"/>
- <f:selectItem itemLabel="Label#6" itemValue="Value#6"/>
- <f:selectItem itemLabel="Label#7" itemValue="Value#7"/>
- <f:selectItem itemLabel="Label#8" itemValue="Value#8"/>
- <f:selectItem itemLabel="Label#9" itemValue="Value#9"/>
- <f:selectItem itemLabel="Label#10" itemValue="Value#10"/>
- <f:selectItem itemLabel="Label#11" itemValue="Value#11"/>
- <f:selectItem itemLabel="Label#12" itemValue="Value#12"/>
- <f:selectItem itemLabel="Label#13" itemValue="Value#13"/>
- <f:selectItem itemLabel="Label#14" itemValue="Value#14"/>
- </input:select>
- <input:inplaceSelect defaultLabel="Edit Text" openOnEdit="true" saveOnSelect="false">
- <f:selectItem itemLabel="Label#1" itemValue="Value#1"/>
- <f:selectItem itemLabel="Label#2" itemValue="Value#2"/>
- <f:selectItem itemLabel="Label#3" itemValue="Value#3"/>
- <f:selectItem itemLabel="Label#4" itemValue="Value#4"/>
- <f:selectItem itemLabel="Label#5" itemValue="Value#5"/>
- <f:selectItem itemLabel="Label#6" itemValue="Value#6"/>
- <f:selectItem itemLabel="Label#7" itemValue="Value#7"/>
- <f:selectItem itemLabel="Label#8" itemValue="Value#8"/>
- <f:selectItem itemLabel="Label#9" itemValue="Value#9"/>
- <f:selectItem itemLabel="Label#10" itemValue="Value#10"/>
- <f:selectItem itemLabel="Label#11" itemValue="Value#11"/>
- <f:selectItem itemLabel="Label#12" itemValue="Value#12"/>
- <f:selectItem itemLabel="Label#13" itemValue="Value#13"/>
- <f:selectItem itemLabel="Label#14" itemValue="Value#14"/>
- </input:inplaceSelect>
- </h:form>
- </output:popupPanel>
- </ui:define>
+<h:form>
+ RF-9567:<br/><br/>
+ <a4j:outputPanel ajaxRendered="true"><h:messages/></a4j:outputPanel>
+
+
+ <input:autocomplete mode="ajax" id="autocomplete" autocompleteMethod="#{autoCompleteBean.autocomplete}"
+ value="#{autoCompleteBean.value}">
+ <f:validateRegex pattern="Alabama"/>
+ </input:autocomplete>
+
+ <a4j:commandButton render="@form" execute="autocomplete"/>
+</h:form>
+<h:form>
+ <input:autocomplete mode="cachedAjax" tokens="," minChars="0"
+ autofill="true" selectFirst="false" layout="table"
+ autocompleteMethod="#{autoCompleteBean.autocomplete}" var="country"
+ fetchValue="#{country.name}">
+ <h:column>
+ #{country.name}
+ </h:column>
+ <h:column>
+ #{country.iso}
+ </h:column>
+ </input:autocomplete>
+</h:form>
+<h:form>
+ <h:commandButton id="leggTilKontroll" value="Button">
+ <misc:componentControl target="popup" operation="show"/>
+ </h:commandButton>
+</h:form>
+<output:popupPanel id="popup" autosized="true">
+ <h:form>
+ <input:autocomplete mode="cachedAjax" autocompleteMethod="#{autoCompleteBean.autocomplete}"
+ var="country" fetchValue="#{country.name}">
+ #{country.name} #{country.iso} #{country.domain}
+ </input:autocomplete>
+ <input:select id="select" enableManualInput="true" defaultLabel="Select Value ...">
+ <f:selectItem itemLabel="Label#1" itemValue="Value#1"/>
+ <f:selectItem itemLabel="Label#2" itemValue="Value#2"/>
+ <f:selectItem itemLabel="Label#3" itemValue="Value#3"/>
+ <f:selectItem itemLabel="Label#4" itemValue="Value#4"/>
+ <f:selectItem itemLabel="Label#5" itemValue="Value#5"/>
+ <f:selectItem itemLabel="Label#6" itemValue="Value#6"/>
+ <f:selectItem itemLabel="Label#7" itemValue="Value#7"/>
+ <f:selectItem itemLabel="Label#8" itemValue="Value#8"/>
+ <f:selectItem itemLabel="Label#9" itemValue="Value#9"/>
+ <f:selectItem itemLabel="Label#10" itemValue="Value#10"/>
+ <f:selectItem itemLabel="Label#11" itemValue="Value#11"/>
+ <f:selectItem itemLabel="Label#12" itemValue="Value#12"/>
+ <f:selectItem itemLabel="Label#13" itemValue="Value#13"/>
+ <f:selectItem itemLabel="Label#14" itemValue="Value#14"/>
+ </input:select>
+ <input:inplaceSelect defaultLabel="Edit Text" openOnEdit="true" saveOnSelect="false">
+ <f:selectItem itemLabel="Label#1" itemValue="Value#1"/>
+ <f:selectItem itemLabel="Label#2" itemValue="Value#2"/>
+ <f:selectItem itemLabel="Label#3" itemValue="Value#3"/>
+ <f:selectItem itemLabel="Label#4" itemValue="Value#4"/>
+ <f:selectItem itemLabel="Label#5" itemValue="Value#5"/>
+ <f:selectItem itemLabel="Label#6" itemValue="Value#6"/>
+ <f:selectItem itemLabel="Label#7" itemValue="Value#7"/>
+ <f:selectItem itemLabel="Label#8" itemValue="Value#8"/>
+ <f:selectItem itemLabel="Label#9" itemValue="Value#9"/>
+ <f:selectItem itemLabel="Label#10" itemValue="Value#10"/>
+ <f:selectItem itemLabel="Label#11" itemValue="Value#11"/>
+ <f:selectItem itemLabel="Label#12" itemValue="Value#12"/>
+ <f:selectItem itemLabel="Label#13" itemValue="Value#13"/>
+ <f:selectItem itemLabel="Label#14" itemValue="Value#14"/>
+ </input:inplaceSelect>
+ </h:form>
+</output:popupPanel>
+</ui:define>
</ui:composition>
-
+
</h:body>
</html>
Added: branches/4.0.0.CR1/examples/input-demo/src/main/webapp/examples/autocompleteConverter.xhtml
===================================================================
--- branches/4.0.0.CR1/examples/input-demo/src/main/webapp/examples/autocompleteConverter.xhtml (rev 0)
+++ branches/4.0.0.CR1/examples/input-demo/src/main/webapp/examples/autocompleteConverter.xhtml 2011-02-25 20:30:06 UTC (rev 21942)
@@ -0,0 +1,37 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:input="http://richfaces.org/input">
+<f:view contentType="text/html"/>
+
+<h:head>
+ <title>Richfaces Autocomplete</title>
+</h:head>
+
+<h:body style="margin: 30px;">
+
+ <ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="title">Autocomplete Converter Example</ui:define>
+ <ui:define name="body_head">Autocomplete Converter Example</ui:define>
+
+ <ui:define name="body">
+ <h:form>
+ <h:outputLabel for="autocompleteConverter">Autocomplete with converter:</h:outputLabel>
+ <input:autocomplete autocompleteMethod="#{autoCompleteBean.autocomplete}" var="country"
+ fetchValue="#{country.name}"
+ mode="ajax" layout="list"
+ converter="autocompleteBeanConverter" value="#{autoCompleteBean.value}"
+ id="autocompleteConverter">
+ #{country.name}
+ </input:autocomplete>
+ <h:commandButton value="Submit Country"/>
+ </h:form>
+ </ui:define>
+ </ui:composition>
+
+</h:body>
+</html>
Modified: branches/4.0.0.CR1/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java
===================================================================
--- branches/4.0.0.CR1/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java 2011-02-25 19:32:28 UTC (rev 21941)
+++ branches/4.0.0.CR1/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java 2011-02-25 20:30:06 UTC (rev 21942)
@@ -21,7 +21,10 @@
*/
package org.richfaces.component;
-import java.io.IOException;
+import org.richfaces.cdk.annotations.*;
+import org.richfaces.context.ExtendedVisitContext;
+import org.richfaces.context.ExtendedVisitContextMode;
+import org.richfaces.renderkit.MetaComponentRenderer;
import javax.el.MethodExpression;
import javax.faces.component.UIComponent;
@@ -30,19 +33,8 @@
import javax.faces.component.visit.VisitContext;
import javax.faces.component.visit.VisitResult;
import javax.faces.context.FacesContext;
-import javax.faces.convert.Converter;
+import java.io.IOException;
-import org.richfaces.cdk.annotations.Attribute;
-import org.richfaces.cdk.annotations.EventName;
-import org.richfaces.cdk.annotations.JsfComponent;
-import org.richfaces.cdk.annotations.JsfRenderer;
-import org.richfaces.cdk.annotations.Signature;
-import org.richfaces.cdk.annotations.Tag;
-import org.richfaces.cdk.annotations.TagType;
-import org.richfaces.context.ExtendedVisitContext;
-import org.richfaces.context.ExtendedVisitContextMode;
-import org.richfaces.renderkit.MetaComponentRenderer;
-
/**
* @author Nick Belaevski
*
@@ -65,8 +57,6 @@
public abstract void setAutocompleteMethod(MethodExpression expression);
- public abstract void setItemConverter(Converter converter);
-
@Attribute(literal = true)
public abstract String getVar();
@@ -98,9 +88,6 @@
@Attribute
public abstract String getTokens();
- @Attribute
- public abstract Converter getItemConverter();
-
@Attribute(defaultValue = "true")
public abstract boolean isAutofill();
Modified: branches/4.0.0.CR1/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java
===================================================================
--- branches/4.0.0.CR1/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java 2011-02-25 19:32:28 UTC (rev 21941)
+++ branches/4.0.0.CR1/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java 2011-02-25 20:30:06 UTC (rev 21942)
@@ -21,34 +21,6 @@
*/
package org.richfaces.renderkit;
-import java.io.IOException;
-import java.sql.ResultSet;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.el.ELException;
-import javax.el.ExpressionFactory;
-import javax.el.MethodExpression;
-import javax.el.MethodNotFoundException;
-import javax.el.ValueExpression;
-import javax.faces.application.ResourceDependencies;
-import javax.faces.application.ResourceDependency;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.PartialResponseWriter;
-import javax.faces.context.PartialViewContext;
-import javax.faces.context.ResponseWriter;
-import javax.faces.convert.Converter;
-import javax.faces.convert.ConverterException;
-import javax.faces.model.ArrayDataModel;
-import javax.faces.model.DataModel;
-import javax.faces.model.ListDataModel;
-import javax.faces.model.ResultDataModel;
-import javax.faces.model.ResultSetDataModel;
-import javax.servlet.jsp.jstl.sql.Result;
-
import org.ajax4jsf.javascript.JSObject;
import org.ajax4jsf.javascript.JSReference;
import org.richfaces.application.ServiceTracker;
@@ -62,6 +34,26 @@
import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
+import javax.el.*;
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.UIComponent;
+import javax.faces.component.ValueHolder;
+import javax.faces.context.FacesContext;
+import javax.faces.context.PartialResponseWriter;
+import javax.faces.context.PartialViewContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+import javax.faces.model.*;
+import javax.servlet.jsp.jstl.sql.Result;
+import java.io.IOException;
+import java.sql.ResultSet;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
/**
* @author Nick Belaevski
*/
@@ -159,42 +151,33 @@
}
}
- protected void encodeItems(FacesContext facesContext, UIComponent component, List<Object> fetchValues)
- throws IOException {
+ protected void encodeItems(FacesContext facesContext, UIComponent component, List<Object> fetchValues) throws IOException {
AbstractAutocomplete comboBox = (AbstractAutocomplete) component;
AutocompleteEncodeStrategy strategy = getStrategy(component);
strategy.encodeItemsContainerBegin(facesContext, component);
- boolean hasEncodedElements = false;
-
Object savedVar = saveVar(facesContext, comboBox.getVar());
- DataModel<Object> model = getItems(facesContext, comboBox);
- for (Iterator<Object> items = model.iterator(); items.hasNext();) {
- hasEncodedElements = true;
+ Iterator<Object> itemsIterator = getItems(facesContext, comboBox).iterator();
- Object nextItem = items.next();
- setVar(facesContext, comboBox.getVar(), nextItem);
+ if (!itemsIterator.hasNext()) {
+ strategy.encodeFakeItem(facesContext, component);
+ } else {
+ while (itemsIterator.hasNext()) {
+ Object item = itemsIterator.next();
- this.encodeItem(facesContext, comboBox, nextItem, strategy);
- if (comboBox.getFetchValue() != null) {
- fetchValues.add(comboBox.getFetchValue().toString());
- } else {
- // TODO use converter
- if (comboBox.getItemConverter() != null) {
- fetchValues.add(comboBox.getItemConverter().getAsString(facesContext, component, nextItem));
- } else {
- fetchValues.add(nextItem.toString());
- }
+ setVar(facesContext, comboBox.getVar(), item);
+ this.encodeItem(facesContext, comboBox, item, strategy);
+ if (comboBox.getFetchValue() != null) {
+ fetchValues.add(comboBox.getFetchValue().toString());
+ } else if(item != null) {
+ fetchValues.add(item.toString());
+ }
}
}
setVar(facesContext, comboBox.getVar(), savedVar);
- if (!hasEncodedElements) {
- strategy.encodeFakeItem(facesContext, component);
- }
-
strategy.encodeItemsContainerEnd(facesContext, component);
}
@@ -226,26 +209,17 @@
public void encodeItem(FacesContext facesContext, AbstractAutocomplete comboBox, Object item,
AutocompleteEncodeStrategy strategy) throws IOException {
- ResponseWriter writer = facesContext.getResponseWriter();
+ ResponseWriter writer = facesContext.getResponseWriter();
if (comboBox.getChildCount() > 0) {
strategy.encodeItem(facesContext, comboBox);
} else {
if (item != null) {
- strategy.encodeItemBegin(facesContext, comboBox);
- writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-au-itm rf-au-opt rf-au-fnt rf-au-inp", null);
- // TODO nick - use converter
- String value = null;
- if (comboBox.getItemConverter() != null) {
- value = comboBox.getItemConverter().getAsString(facesContext, comboBox, item);
- }
- if (value != null) {
- writer.writeText(value, null);
- }
+ strategy.encodeItemBegin(facesContext, comboBox);
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-au-itm rf-au-opt rf-au-fnt rf-au-inp", null);
writer.writeText(item, null);
strategy.encodeItemEnd(facesContext, comboBox);
}
}
-
}
private AutocompleteEncodeStrategy getStrategy(UIComponent component) {
@@ -320,17 +294,18 @@
}
return value;
}
-
+
private Converter getConverterForValue(FacesContext context, UIComponent component) {
- Converter converter = null;
- ValueExpression expression = component.getValueExpression("value");
+ Converter converter = ((ValueHolder) component).getConverter();
+ if (converter == null) {
+ ValueExpression expression = component.getValueExpression("value");
- if (expression != null) {
- Class<?> containerClass = ServiceTracker.getService(context, GenericsIntrospectionService.class).getContainerClass(context, expression);
+ if (expression != null) {
+ Class<?> containerClass = ServiceTracker.getService(context, GenericsIntrospectionService.class).getContainerClass(context, expression);
- converter = InputUtils.getConverterForType(context, containerClass);
+ converter = InputUtils.getConverterForType(context, containerClass);
+ }
}
-
return converter;
}
Modified: branches/4.0.0.CR1/ui/input/ui/src/main/java/org/richfaces/view/facelets/AutocompleteHandler.java
===================================================================
--- branches/4.0.0.CR1/ui/input/ui/src/main/java/org/richfaces/view/facelets/AutocompleteHandler.java 2011-02-25 19:32:28 UTC (rev 21941)
+++ branches/4.0.0.CR1/ui/input/ui/src/main/java/org/richfaces/view/facelets/AutocompleteHandler.java 2011-02-25 20:30:06 UTC (rev 21942)
@@ -21,21 +21,14 @@
*/
package org.richfaces.view.facelets;
+import org.richfaces.component.AbstractAutocomplete;
+
import javax.el.ValueExpression;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
-import javax.faces.view.facelets.ComponentConfig;
-import javax.faces.view.facelets.ComponentHandler;
-import javax.faces.view.facelets.FaceletContext;
-import javax.faces.view.facelets.MetaRule;
-import javax.faces.view.facelets.MetaRuleset;
-import javax.faces.view.facelets.Metadata;
-import javax.faces.view.facelets.MetadataTarget;
-import javax.faces.view.facelets.TagAttribute;
+import javax.faces.view.facelets.*;
-import org.richfaces.component.AbstractAutocomplete;
-
/**
* @author Nick Belaevski
*/
@@ -66,17 +59,6 @@
}
};
}
-
- if ("itemConverter".equals(name)) {
- return new ConverterMetadata(attribute) {
- public void applyMetadata(FaceletContext ctx, Object instance) {
- ((AbstractAutocomplete) instance).setItemConverter(this.getConverter(ctx,
- (AbstractAutocomplete) instance,
- this.getAttr().getValueExpression(ctx, Converter.class)));
- }
- };
- }
-
}
return null;
Modified: branches/4.0.0.CR1/ui/input/ui/src/main/templates/autocomplete.template.xml
===================================================================
--- branches/4.0.0.CR1/ui/input/ui/src/main/templates/autocomplete.template.xml 2011-02-25 19:32:28 UTC (rev 21941)
+++ branches/4.0.0.CR1/ui/input/ui/src/main/templates/autocomplete.template.xml 2011-02-25 20:30:06 UTC (rev 21942)
@@ -30,7 +30,7 @@
onkeyup="#{component.attributes['onkeyup']}"
onkeydown="#{component.attributes['onkeydown']}"
onkeypress="#{component.attributes['onkeypress']}"
- id="#{clientId}Input" value="#{component.attributes['value']}"
+ id="#{clientId}Input" value="#{getInputValue(facesContext, component)}"
disabled="#{disabled}" name="#{clientId}Input"
type="text"
class="rf-au-fnt rf-au-inp #{component.attributes['inputClass']}"
13 years, 2 months
JBoss Rich Faces SVN: r21941 - branches/4.0.0.CR1/ui/output/ui/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2011-02-25 14:32:28 -0500 (Fri, 25 Feb 2011)
New Revision: 21941
Modified:
branches/4.0.0.CR1/ui/output/ui/src/main/java/org/richfaces/component/AbstractAccordion.java
branches/4.0.0.CR1/ui/output/ui/src/main/java/org/richfaces/component/AbstractTabPanel.java
Log:
RF-10624 tabPanel: activeItem attribute on disabled tab work incorrect
Modified: branches/4.0.0.CR1/ui/output/ui/src/main/java/org/richfaces/component/AbstractAccordion.java
===================================================================
--- branches/4.0.0.CR1/ui/output/ui/src/main/java/org/richfaces/component/AbstractAccordion.java 2011-02-25 18:58:19 UTC (rev 21940)
+++ branches/4.0.0.CR1/ui/output/ui/src/main/java/org/richfaces/component/AbstractAccordion.java 2011-02-25 19:32:28 UTC (rev 21941)
@@ -52,6 +52,12 @@
String res = super.getActiveItem();
if (res == null) {
res = getFirstItem().getName();
+ } else {
+ AbstractTogglePanelTitledItem item =
+ (AbstractTogglePanelTitledItem) super.getItemByIndex(super.getChildIndex(res));
+ if (item.isDisabled()) {
+ res = getFirstItem().getName();
+ }
}
return res;
}
Modified: branches/4.0.0.CR1/ui/output/ui/src/main/java/org/richfaces/component/AbstractTabPanel.java
===================================================================
--- branches/4.0.0.CR1/ui/output/ui/src/main/java/org/richfaces/component/AbstractTabPanel.java 2011-02-25 18:58:19 UTC (rev 21940)
+++ branches/4.0.0.CR1/ui/output/ui/src/main/java/org/richfaces/component/AbstractTabPanel.java 2011-02-25 19:32:28 UTC (rev 21941)
@@ -54,6 +54,12 @@
String res = super.getActiveItem();
if (res == null) {
res = getFirstItem().getName();
+ } else {
+ AbstractTogglePanelTitledItem item =
+ (AbstractTogglePanelTitledItem) super.getItemByIndex(super.getChildIndex(res));
+ if (item.isDisabled()) {
+ res = getFirstItem().getName();
+ }
}
return res;
}
13 years, 2 months
JBoss Rich Faces SVN: r21940 - in branches/4.0.0.CR1/ui/iteration/ui/src/main/java/org/richfaces: renderkit and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2011-02-25 13:58:19 -0500 (Fri, 25 Feb 2011)
New Revision: 21940
Modified:
branches/4.0.0.CR1/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataGrid.java
branches/4.0.0.CR1/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataGridRenderer.java
Log:
RF-10622
Modified: branches/4.0.0.CR1/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataGrid.java
===================================================================
--- branches/4.0.0.CR1/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataGrid.java 2011-02-25 18:33:36 UTC (rev 21939)
+++ branches/4.0.0.CR1/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataGrid.java 2011-02-25 18:58:19 UTC (rev 21940)
@@ -58,7 +58,7 @@
generate = "org.richfaces.component.UIDataGrid",
renderer = @JsfRenderer(type = "org.richfaces.DataGridRenderer"),
tag = @Tag(name="dataGrid", handler="org.richfaces.taglib.DataGridHandler", type=TagType.Facelets),
- attributes = {"dataGrid-rows-props.xml", "rowKeyConverter-prop.xml"}
+ attributes = {"core-props.xml", "dataGrid-rows-props.xml", "rowKeyConverter-prop.xml"}
)
public abstract class AbstractDataGrid extends UISequence implements Row, MetaComponentResolver, MetaComponentEncoder {
Modified: branches/4.0.0.CR1/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataGridRenderer.java
===================================================================
--- branches/4.0.0.CR1/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataGridRenderer.java 2011-02-25 18:33:36 UTC (rev 21939)
+++ branches/4.0.0.CR1/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataGridRenderer.java 2011-02-25 18:58:19 UTC (rev 21940)
@@ -23,6 +23,7 @@
package org.richfaces.renderkit;
import java.io.IOException;
+import java.util.Map;
import javax.faces.FacesException;
import javax.faces.application.ResourceDependencies;
@@ -240,8 +241,10 @@
AbstractDataGrid dataGrid = (AbstractDataGrid)component;
writer.startElement(HtmlConstants.TABLE_ELEMENT, dataGrid);
writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, dataGrid.getClientId(facesContext), null);
- writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-dg", null);
-
+ Map<String, Object> attributes = dataGrid.getAttributes();
+ String classes = concatClasses("rf-dg", attributes.get(HtmlConstants.STYLE_CLASS_ATTR));
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, classes, null);
+ RenderKitUtils.renderAttribute(facesContext, "style", attributes.get(HtmlConstants.STYLE_ATTRIBUTE));
encodeCaption(writer, facesContext, dataGrid);
encodeHeader(writer, facesContext, dataGrid, false);
encodeFooter(writer, facesContext, dataGrid, false);
13 years, 2 months
JBoss Rich Faces SVN: r21939 - branches/4.0.0.CR1/ui/iteration/ui/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2011-02-25 13:33:36 -0500 (Fri, 25 Feb 2011)
New Revision: 21939
Modified:
branches/4.0.0.CR1/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataGridRenderer.java
Log:
RF-10616
Modified: branches/4.0.0.CR1/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataGridRenderer.java
===================================================================
--- branches/4.0.0.CR1/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataGridRenderer.java 2011-02-25 17:11:41 UTC (rev 21938)
+++ branches/4.0.0.CR1/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataGridRenderer.java 2011-02-25 18:33:36 UTC (rev 21939)
@@ -288,14 +288,12 @@
int columns = dataGrid.getColumns();
int rest = columns - cell;
- if(rest != 0) {
- for (int i = 0; i < rest; i++) {
- writer.startElement(HtmlConstants.TD_ELEM, dataGrid);
- writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-dg-c", null);
- writer.endElement(HtmlConstants.TD_ELEM);
- }
- writer.endElement(HtmlConstants.TR_ELEMENT);
+ for (int i = 0; i < rest; i++) {
+ writer.startElement(HtmlConstants.TD_ELEM, dataGrid);
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-dg-c", null);
+ writer.endElement(HtmlConstants.TD_ELEM);
}
+ writer.endElement(HtmlConstants.TR_ELEMENT);
}
public DataVisitResult process(FacesContext facesContext, Object rowKey, Object argument) {
13 years, 2 months
JBoss Rich Faces SVN: r21938 - branches/4.0.0.CR1/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2011-02-25 12:11:41 -0500 (Fri, 25 Feb 2011)
New Revision: 21938
Modified:
branches/4.0.0.CR1/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuGroup.js
branches/4.0.0.CR1/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuItem.js
Log:
https://jira.jboss.org/browse/RF-10623
Modified: branches/4.0.0.CR1/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuGroup.js
===================================================================
--- branches/4.0.0.CR1/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuGroup.js 2011-02-25 15:07:34 UTC (rev 21937)
+++ branches/4.0.0.CR1/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuGroup.js 2011-02-25 17:11:41 UTC (rev 21938)
@@ -221,12 +221,12 @@
});
}
- this.__addUserEventHandler("beforecollapse");
+ /*this.__addUserEventHandler("beforecollapse");
this.__addUserEventHandler("collapse");
this.__addUserEventHandler("beforeexpand");
this.__addUserEventHandler("expand");
this.__addUserEventHandler("beforeswitch");
- this.__addUserEventHandler("switch");
+ this.__addUserEventHandler("switch");*/
}
},
@@ -403,11 +403,6 @@
__isMyEvent: function (event) {
return this.id == event.target.id;
},
-
- __fireEvent: function(eventName) {
- var data = {id: this.id};
- return rf.Event.fireById(this.id, eventName, data);
- },
destroy: function () {
rf.Event.unbindById(this.id, "."+this.namespace);
Modified: branches/4.0.0.CR1/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuItem.js
===================================================================
--- branches/4.0.0.CR1/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuItem.js 2011-02-25 15:07:34 UTC (rev 21937)
+++ branches/4.0.0.CR1/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuItem.js 2011-02-25 17:11:41 UTC (rev 21938)
@@ -203,7 +203,7 @@
* @return {void} TODO ...
*/
select: function () {
- var continueProcess = this.__fireBeforeSelect();
+ var continueProcess = this.__fireEvent("beforeSelect");
if (!continueProcess) {
return false;
}
@@ -300,13 +300,7 @@
__unselect: function () {
this.__header().removeClass(this.selectionClass);
},
-
- __fireBeforeSelect : function () {
- return rf.Event.fireById(this.id, "beforeselect", {
- item: this
- });
- },
-
+
__fireSelect : function () {
return rf.Event.fireById(this.id, "select", {
item: this
@@ -318,6 +312,10 @@
item: this
});
},
+
+ __fireEvent : function (eventType, event) {
+ return this.invokeEvent(eventType, rf.getDomElement(this.id), event, {id: this.id, item: this});
+ },
/**
* @private
13 years, 2 months
JBoss Rich Faces SVN: r21937 - branches/4.0.0.CR1/ui/validator/ui/src/main/java/org/richfaces/view/facelets/html.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2011-02-25 10:07:34 -0500 (Fri, 25 Feb 2011)
New Revision: 21937
Modified:
branches/4.0.0.CR1/ui/validator/ui/src/main/java/org/richfaces/view/facelets/html/GraphValidatorHandler.java
Log:
https://issues.jboss.org/browse/RF-10613
Modified: branches/4.0.0.CR1/ui/validator/ui/src/main/java/org/richfaces/view/facelets/html/GraphValidatorHandler.java
===================================================================
--- branches/4.0.0.CR1/ui/validator/ui/src/main/java/org/richfaces/view/facelets/html/GraphValidatorHandler.java 2011-02-25 14:39:11 UTC (rev 21936)
+++ branches/4.0.0.CR1/ui/validator/ui/src/main/java/org/richfaces/view/facelets/html/GraphValidatorHandler.java 2011-02-25 15:07:34 UTC (rev 21937)
@@ -27,8 +27,13 @@
import javax.el.ELException;
import javax.faces.FacesException;
import javax.faces.component.EditableValueHolder;
+import javax.faces.component.StateHolder;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.ComponentSystemEvent;
+import javax.faces.event.ComponentSystemEventListener;
+import javax.faces.event.PostAddToViewEvent;
import javax.faces.validator.BeanValidator;
import javax.faces.validator.Validator;
import javax.faces.view.facelets.ComponentConfig;
@@ -46,6 +51,31 @@
private static final String BUILT_IN_BEAN_VALIDATOR_ATTRIBUTE_NAME = GraphValidatorHandler.class.getName()
+ ":BUILT_IN_BEAN_VALIDATOR_ATTRIBUTE_NAME";
+ private class FacesBeanValidatorAddListener implements ComponentSystemEventListener, StateHolder {
+
+ public void processEvent(ComponentSystemEvent event) throws AbortProcessingException {
+ FacesContext context = FacesContext.getCurrentInstance();
+ Validator childrenValidator = createChildrenValidator(context, event.getComponent());
+ setupValidators(context, event.getComponent(), childrenValidator);
+ }
+
+ public Object saveState(FacesContext context) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void restoreState(FacesContext context, Object state) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isTransient() {
+ return true;
+ }
+
+ public void setTransient(boolean newTransientValue) {
+ throw new UnsupportedOperationException();
+ }
+ }
+
public GraphValidatorHandler(ComponentConfig config) {
super(config);
}
@@ -113,13 +143,20 @@
}
}
+ private Validator createChildrenValidator(FacesContext context, UIComponent c) {
+ AbstractGraphValidator graphValidator = (AbstractGraphValidator) c;
+
+ return graphValidator.createChildrenValidator(context);
+ }
+
@Override
public void applyNextHandler(FaceletContext ctx, UIComponent c) throws IOException, FacesException, ELException {
super.applyNextHandler(ctx, c);
- AbstractGraphValidator graphValidator = (AbstractGraphValidator) c;
- Validator childrenValidator = graphValidator.createChildrenValidator(ctx.getFacesContext());
-
- setupValidators(ctx.getFacesContext(), graphValidator, childrenValidator);
+ if (c.isInView()) {
+ setupValidators(ctx.getFacesContext(), c, createChildrenValidator(ctx.getFacesContext(), c));
+ } else {
+ c.subscribeToEvent(PostAddToViewEvent.class, new FacesBeanValidatorAddListener());
+ }
}
}
13 years, 2 months
JBoss Rich Faces SVN: r21936 - in branches/4.0.0.CR1/ui: iteration/ui/src/main/java/org/richfaces/component and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2011-02-25 09:39:11 -0500 (Fri, 25 Feb 2011)
New Revision: 21936
Added:
branches/4.0.0.CR1/ui/common/ui/src/main/java/org/richfaces/StateHolderArray.java
Removed:
branches/4.0.0.CR1/ui/common/ui/src/main/java/org/richfaces/StateHolderList.java
Modified:
branches/4.0.0.CR1/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTable.java
Log:
https://issues.jboss.org/browse/RF-10615
Copied: branches/4.0.0.CR1/ui/common/ui/src/main/java/org/richfaces/StateHolderArray.java (from rev 21934, branches/4.0.0.CR1/ui/common/ui/src/main/java/org/richfaces/StateHolderList.java)
===================================================================
--- branches/4.0.0.CR1/ui/common/ui/src/main/java/org/richfaces/StateHolderArray.java (rev 0)
+++ branches/4.0.0.CR1/ui/common/ui/src/main/java/org/richfaces/StateHolderArray.java 2011-02-25 14:39:11 UTC (rev 21936)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces;
+
+import java.util.ArrayList;
+
+import javax.faces.component.StateHolder;
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+
+import com.google.common.collect.Lists;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class StateHolderArray implements StateHolder {
+
+ private boolean tranzient = false;
+
+ private ArrayList<Object> backingList = Lists.newArrayListWithCapacity(2);
+
+ public Object saveState(FacesContext context) {
+ Object[] savedState = new Object[backingList.size()];
+
+ boolean hasNonNullState = false;
+
+ for (int i = 0; i < savedState.length; i++) {
+ Object state = UIComponentBase.saveAttachedState(context, backingList.get(i));
+ savedState[i] = state;
+
+ if (state != null) {
+ hasNonNullState = true;
+ }
+ }
+
+ if (hasNonNullState) {
+ return savedState;
+ } else {
+ return null;
+ }
+ }
+
+ public void restoreState(FacesContext context, Object stateObject) {
+ if (stateObject != null) {
+ Object[] state = (Object[]) stateObject;
+
+ backingList.ensureCapacity(state.length);
+
+ for (int i = 0; i < state.length; i++) {
+ backingList.add(UIComponentBase.restoreAttachedState(context, state[i]));
+ }
+ }
+ }
+
+ public boolean isTransient() {
+ return tranzient;
+ }
+
+ public void setTransient(boolean newTransientValue) {
+ this.tranzient = newTransientValue;
+ }
+
+ public boolean add(Object e) {
+ return backingList.add(e);
+ }
+
+ public Object get(int index) {
+ return backingList.get(index);
+ }
+
+ public boolean isEmpty() {
+ return backingList.isEmpty();
+ }
+
+}
Deleted: branches/4.0.0.CR1/ui/common/ui/src/main/java/org/richfaces/StateHolderList.java
===================================================================
--- branches/4.0.0.CR1/ui/common/ui/src/main/java/org/richfaces/StateHolderList.java 2011-02-25 14:13:02 UTC (rev 21935)
+++ branches/4.0.0.CR1/ui/common/ui/src/main/java/org/richfaces/StateHolderList.java 2011-02-25 14:39:11 UTC (rev 21936)
@@ -1,170 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2011, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces;
-
-import java.util.AbstractList;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-
-import javax.faces.component.StateHolder;
-import javax.faces.component.UIComponentBase;
-import javax.faces.context.FacesContext;
-
-import com.google.common.collect.Lists;
-
-/**
- * @author Nick Belaevski
- *
- */
-public class StateHolderList extends AbstractList<Object> implements StateHolder {
-
- private boolean tranzient = false;
-
- private ArrayList<Object> backingList = Lists.newArrayListWithCapacity(2);
-
- public Object saveState(FacesContext context) {
- Object[] savedState = new Object[backingList.size()];
-
- boolean hasNonNullState = false;
-
- for (int i = 0; i < savedState.length; i++) {
- Object state = UIComponentBase.saveAttachedState(context, backingList.get(i));
- savedState[i] = state;
-
- if (state != null) {
- hasNonNullState = true;
- }
- }
-
- if (hasNonNullState) {
- return savedState;
- } else {
- return null;
- }
- }
-
- public void restoreState(FacesContext context, Object stateObject) {
- if (stateObject != null) {
- Object[] state = (Object[]) stateObject;
-
- backingList.ensureCapacity(state.length);
-
- for (int i = 0; i < state.length; i++) {
- backingList.add(UIComponentBase.restoreAttachedState(context, state[i]));
- }
- }
- }
-
- public boolean isTransient() {
- return tranzient;
- }
-
- public void setTransient(boolean newTransientValue) {
- this.tranzient = newTransientValue;
- }
-
- public boolean contains(Object o) {
- return backingList.contains(o);
- }
-
- public Iterator<Object> iterator() {
- return backingList.iterator();
- }
-
- public boolean add(Object e) {
- return backingList.add(e);
- }
-
- public boolean remove(Object o) {
- return backingList.remove(o);
- }
-
- public boolean containsAll(Collection<?> c) {
- return backingList.containsAll(c);
- }
-
- public boolean addAll(Collection<? extends Object> c) {
- return backingList.addAll(c);
- }
-
- public boolean addAll(int index, Collection<? extends Object> c) {
- return backingList.addAll(index, c);
- }
-
- public boolean removeAll(Collection<?> c) {
- return backingList.removeAll(c);
- }
-
- public boolean retainAll(Collection<?> c) {
- return backingList.retainAll(c);
- }
-
- public void clear() {
- backingList.clear();
- }
-
- public Object set(int index, Object element) {
- return backingList.set(index, element);
- }
-
- public void add(int index, Object element) {
- backingList.add(index, element);
- }
-
- public Object remove(int index) {
- return backingList.remove(index);
- }
-
- public int indexOf(Object o) {
- return backingList.indexOf(o);
- }
-
- public int lastIndexOf(Object o) {
- return backingList.lastIndexOf(o);
- }
-
- public ListIterator<Object> listIterator() {
- return backingList.listIterator();
- }
-
- public ListIterator<Object> listIterator(int index) {
- return backingList.listIterator(index);
- }
-
- public List<Object> subList(int fromIndex, int toIndex) {
- return backingList.subList(fromIndex, toIndex);
- }
-
- @Override
- public Object get(int index) {
- return backingList.get(index);
- }
-
- @Override
- public int size() {
- return backingList.size();
- }
-
-}
Modified: branches/4.0.0.CR1/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTable.java
===================================================================
--- branches/4.0.0.CR1/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTable.java 2011-02-25 14:13:02 UTC (rev 21935)
+++ branches/4.0.0.CR1/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTable.java 2011-02-25 14:39:11 UTC (rev 21936)
@@ -28,7 +28,7 @@
import javax.faces.event.AbortProcessingException;
import javax.faces.event.FacesEvent;
-import org.richfaces.StateHolderList;
+import org.richfaces.StateHolderArray;
import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.annotations.JsfRenderer;
@@ -142,7 +142,7 @@
}
public void setIterationState(Object stateObject) {
- StateHolderList stateHolderList = (StateHolderList) stateObject;
+ StateHolderArray stateHolderList = (StateHolderArray) stateObject;
if (stateHolderList != null && !stateHolderList.isEmpty()) {
super.setIterationState(stateHolderList.get(0));
@@ -154,7 +154,7 @@
}
public Object getIterationState() {
- StateHolderList holderList = new StateHolderList();
+ StateHolderArray holderList = new StateHolderArray();
holderList.add(super.getIterationState());
holderList.add(getStateHelper().get(PropertyKeys.expanded));
13 years, 2 months
JBoss Rich Faces SVN: r21935 - branches/4.0.0.CR1/ui/input/ui/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2011-02-25 09:13:02 -0500 (Fri, 25 Feb 2011)
New Revision: 21935
Modified:
branches/4.0.0.CR1/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java
Log:
https://jira.jboss.org/browse/RF-10617
Modified: branches/4.0.0.CR1/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java
===================================================================
--- branches/4.0.0.CR1/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java 2011-02-25 12:03:29 UTC (rev 21934)
+++ branches/4.0.0.CR1/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java 2011-02-25 14:13:02 UTC (rev 21935)
@@ -271,7 +271,7 @@
return;
}
Map<String, String> requestParameters = context.getExternalContext().getRequestParameterMap();
- String value = requestParameters.get(component.getClientId(context) + "Value");
+ String value = requestParameters.get(component.getClientId(context) + "Input");
if (value != null) {
autocomplete.setSubmittedValue(value);
}
13 years, 2 months
JBoss Rich Faces SVN: r21934 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-02-25 07:03:29 -0500 (Fri, 25 Feb 2011)
New Revision: 21934
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/CollapsibleSubTable.java
Log:
forgetten commit to CollapsibleSubTable model
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/CollapsibleSubTable.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/CollapsibleSubTable.java 2011-02-25 11:53:36 UTC (rev 21933)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/CollapsibleSubTable.java 2011-02-25 12:03:29 UTC (rev 21934)
@@ -5,7 +5,6 @@
import org.jboss.test.selenium.framework.AjaxSelenium;
import org.jboss.test.selenium.framework.AjaxSeleniumProxy;
-import org.jboss.test.selenium.locator.ElementLocator;
import org.jboss.test.selenium.locator.ExtendedLocator;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.jboss.test.selenium.locator.reference.ReferencedLocator;
@@ -64,6 +63,10 @@
public boolean isNoData() {
return selenium.isElementPresent(noData) && selenium.isVisible(noData);
}
+
+ public boolean isVisible() {
+ return selenium.isElementPresent(root.getLocator()) && selenium.isVisible(root.getLocator());
+ }
public ExtendedLocator<JQueryLocator> getHeader() {
return header;
13 years, 2 months