JBoss Rich Faces SVN: r19717 - management/design-4x/tree.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-10-27 19:29:43 -0400 (Wed, 27 Oct 2010)
New Revision: 19717
Modified:
management/design-4x/tree/tree.html
Log:
https://jira.jboss.org/browse/RF-9315
Modified: management/design-4x/tree/tree.html
===================================================================
--- management/design-4x/tree/tree.html 2010-10-27 21:28:56 UTC (rev 19716)
+++ management/design-4x/tree/tree.html 2010-10-27 23:29:43 UTC (rev 19717)
@@ -38,63 +38,63 @@
<div class="tree_level tree_level_last">
<div class="tree_item">
- <div class="tree_icon tree_status_minus"></div><div class="tree_selarea"><div class="tree_icon tree_node"></div><span class="tree_item_name">Node name</span></div>
+ <div class="tree_icon tree_status_minus"></div><div class="tree_selarea"><div class="tree_icon tree_node"></div><span class="tree_item_name">Node name 1</span></div>
</div>
+ <div class="tree_level">
+ <div class="tree_item">
+ <div class="tree_icon tree_status_blank"></div><div class="tree_selarea"><div class="tree_icon tree_node"></div><span class="tree_item_name">Node name 1.1</span></div>
+ </div>
+ </div>
+ <div class="tree_level">
+ <div class="tree_item">
+ <div class="tree_icon tree_status_minus"></div><div class="tree_selarea"><div class="tree_icon tree_node"></div><span class="tree_item_name">Node name 1.2</span></div>
+ </div>
<div class="tree_level">
<div class="tree_item">
- <div class="tree_icon tree_status_blank"></div><div class="tree_selarea"><div class="tree_icon tree_node"></div><span class="tree_item_name">Node name</span></div>
+ <div class="tree_icon tree_status_blank"></div><div class="tree_selarea tree_selected"><div class="tree_icon tree_node"></div><span class="tree_item_name">Very long node name 1.2.1</span></div>
</div>
</div>
- <div class="tree_level">
+ <div class="tree_level tree_collapse">
<div class="tree_item">
- <div class="tree_icon tree_status_minus"></div><div class="tree_selarea"><div class="tree_icon tree_node"></div><span class="tree_item_name">Node name</span></div>
+ <div class="tree_icon tree_status_plus"></div><div class="tree_selarea"><div class="tree_icon tree_node"></div><span class="tree_item_name">Node name 1.2.2</span></div>
</div>
<div class="tree_level">
<div class="tree_item">
- <div class="tree_icon tree_status_blank"></div><div class="tree_selarea tree_selected"><div class="tree_icon tree_node"></div><span class="tree_item_name">Very long node name</span></div>
+ <div class="tree_icon tree_status_minus"></div><div class="tree_selarea"><div class="tree_icon tree_node"></div><span class="tree_item_name">Node name 1.2.2.1</span></div>
</div>
</div>
- <div class="tree_level tree_collapse">
+ <div class="tree_level tree_level_last">
<div class="tree_item">
- <div class="tree_icon tree_status_plus"></div><div class="tree_selarea"><div class="tree_icon tree_node"></div><span class="tree_item_name">Node name</span></div>
+ <div class="tree_icon tree_status_minus"></div><div class="tree_selarea"><div class="tree_icon tree_node"></div><span class="tree_item_name">Node name 1.2.2.2</span></div>
</div>
- <div class="tree_level">
- <div class="tree_item">
- <div class="tree_icon tree_status_minus"></div><div class="tree_selarea"><div class="tree_icon tree_node"></div><span class="tree_item_name">Node name</span></div>
- </div>
- </div>
<div class="tree_level tree_level_last">
<div class="tree_item">
- <div class="tree_icon tree_status_minus"></div><div class="tree_selarea"><div class="tree_icon tree_node"></div><span class="tree_item_name">Node name</span></div>
+ <div class="tree_icon tree_status_minus"></div><div class="tree_selarea"><div class="tree_icon tree_node"></div><span class="tree_item_name">Node name 1.2.2.2.1</span></div>
</div>
+ <div class="tree_level">
+ <div class="tree_item">
+ <div class="tree_icon tree_status_blank"></div><div class="tree_selarea"><div class="tree_icon tree_child"></div><span class="tree_item_name">Node name 1.2.2.2.1.1</span></div>
+ </div>
+ </div>
<div class="tree_level tree_level_last">
<div class="tree_item">
- <div class="tree_icon tree_status_minus"></div><div class="tree_selarea"><div class="tree_icon tree_node"></div><span class="tree_item_name">Node name</span></div>
+ <div class="tree_icon tree_status_blank"></div><div class="tree_selarea"><div class="tree_icon tree_child"></div><span class="tree_item_name">Node name 1.2.2.2.1.2</span></div>
</div>
- <div class="tree_level">
- <div class="tree_item">
- <div class="tree_icon tree_status_blank"></div><div class="tree_selarea"><div class="tree_icon tree_child"></div><span class="tree_item_name">Node name</span></div>
- </div>
- </div>
- <div class="tree_level tree_level_last">
- <div class="tree_item">
- <div class="tree_icon tree_status_blank"></div><div class="tree_selarea"><div class="tree_icon tree_child"></div><span class="tree_item_name">Node name</span></div>
- </div>
- </div>
</div>
</div>
</div>
- <div class="tree_level tree_level_last">
- <div class="tree_item">
- <div class="tree_icon tree_status_blank"></div><div class="tree_selarea"><div class="tree_icon tree_child"></div><span class="tree_item_name">Node name</span></div>
- </div>
- </div>
</div>
<div class="tree_level tree_level_last">
<div class="tree_item">
- <div class="tree_icon tree_status_blank"></div><div class="tree_selarea"><div class="tree_icon tree_child"></div><span class="tree_item_name">Node name</span></div>
+ <div class="tree_icon tree_status_blank"></div><div class="tree_selarea"><div class="tree_icon tree_child"></div><span class="tree_item_name">Node name 1.2.3</span></div>
</div>
</div>
+ </div>
+ <div class="tree_level tree_level_last">
+ <div class="tree_item">
+ <div class="tree_icon tree_status_blank"></div><div class="tree_selarea"><div class="tree_icon tree_child"></div><span class="tree_item_name">Node name 1.3</span></div>
+ </div>
+ </div>
</div>
14 years, 3 months
JBoss Rich Faces SVN: r19716 - in branches/RF-8742/ui/validator: impl/src/test/java/org/richfaces/validator and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-10-27 17:28:56 -0400 (Wed, 27 Oct 2010)
New Revision: 19716
Added:
branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/FacesObjectDescriptor.java
branches/RF-8742/ui/validator/impl/src/test/java/org/richfaces/validator/FacesConverterServiceTest.java
Removed:
branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/ValidatorDescriptor.java
Modified:
branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/BeanValidatorService.java
branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/ConverterDescriptor.java
branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/FacesConverterService.java
branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/FacesValidatorService.java
branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/component/behavior/ClientValidatorBehavior.java
branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/component/behavior/ClientValidatorImpl.java
branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientValidatorRenderer.java
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorGetValidatorTest.java
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetClientSideScriptTest.java
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetComponentScriptTest.java
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererTestBase.java
Log:
CODING IN PROGRESS - issue RF-9520: ConverterService unit tests and implementation
https://jira.jboss.org/browse/RF-9520
Modified: branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/BeanValidatorService.java
===================================================================
--- branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/BeanValidatorService.java 2010-10-27 20:58:16 UTC (rev 19715)
+++ branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/BeanValidatorService.java 2010-10-27 21:28:56 UTC (rev 19716)
@@ -19,7 +19,7 @@
* @param expression
* @return
*/
- Collection<ValidatorDescriptor> getConstrains(FacesContext context, ValueExpression expression,Class<?> ...groups);
+ Collection<FacesObjectDescriptor> getConstrains(FacesContext context, ValueExpression expression,Class<?> ...groups);
Collection<String> validateExpression(FacesContext context,ValueExpression expression, Object newValue,Class<?> ...groups);
Modified: branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/ConverterDescriptor.java
===================================================================
--- branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/ConverterDescriptor.java 2010-10-27 20:58:16 UTC (rev 19715)
+++ branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/ConverterDescriptor.java 2010-10-27 21:28:56 UTC (rev 19716)
@@ -1,5 +1,5 @@
package org.richfaces.validator;
-public interface ConverterDescriptor extends ValidatorDescriptor {
+public interface ConverterDescriptor extends FacesObjectDescriptor {
}
Modified: branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/FacesConverterService.java
===================================================================
--- branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/FacesConverterService.java 2010-10-27 20:58:16 UTC (rev 19715)
+++ branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/FacesConverterService.java 2010-10-27 21:28:56 UTC (rev 19716)
@@ -11,6 +11,6 @@
*/
public interface FacesConverterService {
- ConverterDescriptor getConverterDescription(FacesContext context,Converter validator);
+ ConverterDescriptor getConverterDescription(FacesContext context,Converter converter);
}
Copied: branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/FacesObjectDescriptor.java (from rev 19713, branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/ValidatorDescriptor.java)
===================================================================
--- branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/FacesObjectDescriptor.java (rev 0)
+++ branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/FacesObjectDescriptor.java 2010-10-27 21:28:56 UTC (rev 19716)
@@ -0,0 +1,44 @@
+package org.richfaces.validator;
+
+import java.util.Map;
+
+import javax.faces.application.FacesMessage;
+
+/**
+ * <p class="changed_added_4_0">
+ * Inmlementations of this interface describe JSF or JSR-303 validators. Because JSF supports 2 types of validators,
+ * this interface unifies access to them.
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public interface FacesObjectDescriptor {
+
+ /**
+ * <p class="changed_added_4_0">
+ * Returns JSF {@link javax.faces.validator.Validator} implementation class or JSR-303 annotation class.
+ * </p>
+ *
+ * @return
+ */
+ Class<?> getImplementationClass();
+
+ /**
+ * <p class="changed_added_4_0">
+ * Concrete validator parameters
+ * </p>
+ *
+ * @return non null map with validator instance parameters.
+ */
+ Map<String, ? extends Object> getAdditionalParameters();
+
+ /**
+ * <p class="changed_added_4_0">
+ * Localized validator message
+ * </p>
+ *
+ * @return
+ */
+ FacesMessage getMessage();
+}
Property changes on: branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/FacesObjectDescriptor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/FacesValidatorService.java
===================================================================
--- branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/FacesValidatorService.java 2010-10-27 20:58:16 UTC (rev 19715)
+++ branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/FacesValidatorService.java 2010-10-27 21:28:56 UTC (rev 19716)
@@ -6,5 +6,5 @@
public interface FacesValidatorService {
- ValidatorDescriptor getValidatorDescription(FacesContext context,Validator validator);
+ FacesObjectDescriptor getValidatorDescription(FacesContext context,Validator validator);
}
Deleted: branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/ValidatorDescriptor.java
===================================================================
--- branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/ValidatorDescriptor.java 2010-10-27 20:58:16 UTC (rev 19715)
+++ branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/ValidatorDescriptor.java 2010-10-27 21:28:56 UTC (rev 19716)
@@ -1,42 +0,0 @@
-package org.richfaces.validator;
-
-import java.util.Map;
-
-/**
- * <p class="changed_added_4_0">
- * Inmlementations of this interface describe JSF or JSR-303 validators. Because JSF supports 2 types of validators,
- * this interface unifies access to them.
- * </p>
- *
- * @author asmirnov(a)exadel.com
- *
- */
-public interface ValidatorDescriptor {
-
- /**
- * <p class="changed_added_4_0">
- * Returns JSF {@link javax.faces.validator.Validator} implementation class or JSR-303 annotation class.
- * </p>
- *
- * @return
- */
- Class<?> getValidatorClass();
-
- /**
- * <p class="changed_added_4_0">
- * Concrete validator parameters
- * </p>
- *
- * @return non null map with validator instance parameters.
- */
- Map<String, ? extends Object> getValidatorParameters();
-
- /**
- * <p class="changed_added_4_0">
- * Localized validator message
- * </p>
- *
- * @return
- */
- String getMessage();
-}
Added: branches/RF-8742/ui/validator/impl/src/test/java/org/richfaces/validator/FacesConverterServiceTest.java
===================================================================
--- branches/RF-8742/ui/validator/impl/src/test/java/org/richfaces/validator/FacesConverterServiceTest.java (rev 0)
+++ branches/RF-8742/ui/validator/impl/src/test/java/org/richfaces/validator/FacesConverterServiceTest.java 2010-10-27 21:28:56 UTC (rev 19716)
@@ -0,0 +1,37 @@
+package org.richfaces.validator;
+
+import static org.junit.Assert.*;
+
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+
+public class FacesConverterServiceTest {
+
+ FacesConverterService serviceImpl;
+
+ Converter converter;
+
+ private FacesContext context;
+
+ @Before
+ public void setUp() {
+ // create service impl.
+ }
+
+ @After
+ public void tearDown() {
+ serviceImpl = null;
+ }
+
+ @Test
+ public void getConverterDescription() throws Exception {
+ ConverterDescriptor converterDescription = serviceImpl.getConverterDescription(context, converter);
+ assertEquals(converter.getClass(), converterDescription.getImplementationClass());
+ }
+
+}
Property changes on: branches/RF-8742/ui/validator/impl/src/test/java/org/richfaces/validator/FacesConverterServiceTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/component/behavior/ClientValidatorBehavior.java
===================================================================
--- branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/component/behavior/ClientValidatorBehavior.java 2010-10-27 20:58:16 UTC (rev 19715)
+++ branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/component/behavior/ClientValidatorBehavior.java 2010-10-27 21:28:56 UTC (rev 19716)
@@ -6,7 +6,7 @@
import javax.faces.component.behavior.ClientBehaviorContext;
import org.richfaces.validator.ConverterDescriptor;
-import org.richfaces.validator.ValidatorDescriptor;
+import org.richfaces.validator.FacesObjectDescriptor;
/**
* <p class="changed_added_4_0">Interface for JSF Behavior that creates scripts for client-side validation</p>
@@ -39,7 +39,7 @@
* @param context
* @return
*/
- Collection<ValidatorDescriptor> getValidators(ClientBehaviorContext context);
+ Collection<FacesObjectDescriptor> getValidators(ClientBehaviorContext context);
/**
* <p class="changed_added_4_0">Returns array of classes that represents JSR-303 validation groups.</p>
Modified: branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/component/behavior/ClientValidatorImpl.java
===================================================================
--- branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/component/behavior/ClientValidatorImpl.java 2010-10-27 20:58:16 UTC (rev 19715)
+++ branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/component/behavior/ClientValidatorImpl.java 2010-10-27 21:28:56 UTC (rev 19716)
@@ -48,7 +48,7 @@
import org.richfaces.validator.ConverterDescriptor;
import org.richfaces.validator.FacesConverterService;
import org.richfaces.validator.FacesValidatorService;
-import org.richfaces.validator.ValidatorDescriptor;
+import org.richfaces.validator.FacesObjectDescriptor;
import com.google.common.collect.Lists;
@@ -177,10 +177,10 @@
* @see org.richfaces.component.behavior.ClientValidatorBehavior#getValidators(javax.faces.component.behavior.
* ClientBehaviorContext)
*/
- public Collection<ValidatorDescriptor> getValidators(ClientBehaviorContext context) {
+ public Collection<FacesObjectDescriptor> getValidators(ClientBehaviorContext context) {
UIComponent component = context.getComponent();
if (component instanceof EditableValueHolder) {
- ArrayList<ValidatorDescriptor> validators = Lists.newArrayList();
+ ArrayList<FacesObjectDescriptor> validators = Lists.newArrayList();
EditableValueHolder input = (EditableValueHolder) component;
Validator[] facesValidators = input.getValidators();
FacesContext facesContext = context.getFacesContext();
Modified: branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientValidatorRenderer.java
===================================================================
--- branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientValidatorRenderer.java 2010-10-27 20:58:16 UTC (rev 19715)
+++ branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientValidatorRenderer.java 2010-10-27 21:28:56 UTC (rev 19716)
@@ -25,7 +25,7 @@
import org.richfaces.validator.LibraryFunction;
import org.richfaces.validator.LibraryScriptString;
import org.richfaces.validator.ScriptNotFoundException;
-import org.richfaces.validator.ValidatorDescriptor;
+import org.richfaces.validator.FacesObjectDescriptor;
import com.google.common.collect.Lists;
@@ -130,7 +130,7 @@
ComponentValidatorScript createValidatorScript(ClientBehaviorContext behaviorContext,
ClientValidatorBehavior behavior) {
ValidatorScriptBase validatorScript;
- Collection<ValidatorDescriptor> validators = behavior.getValidators(behaviorContext);
+ Collection<FacesObjectDescriptor> validators = behavior.getValidators(behaviorContext);
if (!validators.isEmpty()) {
try {
ConverterDescriptor converter = behavior.getConverter(behaviorContext);
@@ -160,7 +160,7 @@
}
private ValidatorScriptBase createValidatorScript(ClientBehaviorContext behaviorContext,
- ClientValidatorBehavior behavior, Collection<ValidatorDescriptor> validators,
+ ClientValidatorBehavior behavior, Collection<FacesObjectDescriptor> validators,
LibraryScriptString clientSideConverterScript) {
Collection<? extends LibraryScriptString> validatorScripts = getClientSideValidatorScript(behaviorContext.getFacesContext(), validators);
if (validatorScripts.isEmpty()) {
@@ -199,10 +199,10 @@
return createClientFunction(converter, VALUE_LITERAL, clientScriptService);
}
- private LibraryScriptString createClientFunction(ValidatorDescriptor descriptor, JSLiteral variable,
+ private LibraryScriptString createClientFunction(FacesObjectDescriptor descriptor, JSLiteral variable,
ClientScriptService clientScriptService) throws ScriptNotFoundException {
- LibraryFunction script = clientScriptService.getScript(descriptor.getValidatorClass());
- return new LibraryScriptFunction(script, variable, descriptor.getMessage(), descriptor.getValidatorParameters());
+ LibraryFunction script = clientScriptService.getScript(descriptor.getImplementationClass());
+ return new LibraryScriptFunction(script, variable, descriptor.getMessage(), descriptor.getAdditionalParameters());
}
/**
@@ -216,11 +216,11 @@
* @throws ScriptNotFoundException
*/
Collection<? extends LibraryScriptString> getClientSideValidatorScript(FacesContext facesContext,
- Collection<ValidatorDescriptor> validators) {
+ Collection<FacesObjectDescriptor> validators) {
ClientScriptService clientScriptService =
ServiceTracker.getService(facesContext, ClientScriptService.class);
List<LibraryScriptString> scripts = Lists.newArrayList();
- for (ValidatorDescriptor validator : validators) {
+ for (FacesObjectDescriptor validator : validators) {
try {
scripts.add(createClientFunction(validator, CONVERTED_VALUE_LITERAL, clientScriptService));
} catch (ScriptNotFoundException e) {
Modified: branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorGetValidatorTest.java
===================================================================
--- branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorGetValidatorTest.java 2010-10-27 20:58:16 UTC (rev 19715)
+++ branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorGetValidatorTest.java 2010-10-27 21:28:56 UTC (rev 19716)
@@ -8,6 +8,7 @@
import java.util.Collection;
import javax.el.ValueExpression;
+import javax.faces.application.FacesMessage;
import javax.faces.validator.Validator;
import javax.validation.groups.Default;
@@ -21,7 +22,7 @@
import org.richfaces.application.ServiceTracker;
import org.richfaces.validator.BeanValidatorService;
import org.richfaces.validator.FacesValidatorService;
-import org.richfaces.validator.ValidatorDescriptor;
+import org.richfaces.validator.FacesObjectDescriptor;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
@@ -38,7 +39,7 @@
@RunWith(MockTestRunner.class)
public class BehaviorGetValidatorTest extends BehaviorTestBase {
- private static final String VALIDATION_ERROR = "Validation Error";
+ private static final FacesMessage VALIDATION_ERROR = new FacesMessage("Validation Error");
private static final Class<?>[] DEFAULT_GROUP = { Default.class };
@@ -46,7 +47,7 @@
private Validator validator;
@Mock
- private ValidatorDescriptor beanValidatorDescriptor;
+ private FacesObjectDescriptor beanValidatorDescriptor;
@Mock
private BeanValidatorService validatorService;
@@ -87,14 +88,14 @@
controller.verify();
}
- private Collection<ValidatorDescriptor> checkValidator() {
+ private Collection<FacesObjectDescriptor> checkValidator() {
controller.replay();
- Collection<ValidatorDescriptor> validators = behavior.getValidators(behaviorContext);
+ Collection<FacesObjectDescriptor> validators = behavior.getValidators(behaviorContext);
// controller.verify();
return validators;
}
- private void setupBeanValidator(ValidatorDescriptor... validators) {
+ private void setupBeanValidator(FacesObjectDescriptor... validators) {
expect(validatorService.getConstrains(environment.getFacesContext(), expression, DEFAULT_GROUP)).andStubReturn(
Lists.newArrayList(validators));
@@ -103,8 +104,8 @@
private void setupComponentValidator(Validator... validators) {
expect(input.getValidators()).andStubReturn(validators);
for (Validator validator : validators) {
- ValidatorDescriptor validatorDescriptor = environment.createMock(ValidatorDescriptor.class);
- expect((Class) validatorDescriptor.getValidatorClass()).andStubReturn(validator.getClass());
+ FacesObjectDescriptor validatorDescriptor = environment.createMock(FacesObjectDescriptor.class);
+ expect((Class) validatorDescriptor.getImplementationClass()).andStubReturn(validator.getClass());
expect(validatorDescriptor.getMessage()).andStubReturn(VALIDATION_ERROR);
expect(facesValidatorService.getValidatorDescription(environment.getFacesContext(), validator))
.andStubReturn(validatorDescriptor);
@@ -122,10 +123,10 @@
public void testComponentValidator() throws Exception {
setupComponentValidator(validator);
setupBeanValidator();
- Collection<ValidatorDescriptor> validators = checkValidator();
+ Collection<FacesObjectDescriptor> validators = checkValidator();
assertEquals(1, validators.size());
- ValidatorDescriptor validatorDescriptor = Iterables.getOnlyElement(validators);
- assertSame(validator.getClass(), validatorDescriptor.getValidatorClass());
+ FacesObjectDescriptor validatorDescriptor = Iterables.getOnlyElement(validators);
+ assertSame(validator.getClass(), validatorDescriptor.getImplementationClass());
assertEquals(VALIDATION_ERROR, validatorDescriptor.getMessage());
controller.verify();
}
@@ -134,9 +135,9 @@
public void testBeanValidators() throws Exception {
setupComponentValidator();
setupBeanValidator(beanValidatorDescriptor);
- Collection<ValidatorDescriptor> validators = checkValidator();
+ Collection<FacesObjectDescriptor> validators = checkValidator();
assertEquals(1, validators.size());
- ValidatorDescriptor validatorDescriptor = Iterables.getOnlyElement(validators);
+ FacesObjectDescriptor validatorDescriptor = Iterables.getOnlyElement(validators);
assertSame(beanValidatorDescriptor, validatorDescriptor);
controller.verify();
}
Modified: branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetClientSideScriptTest.java
===================================================================
--- branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetClientSideScriptTest.java 2010-10-27 20:58:16 UTC (rev 19715)
+++ branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetClientSideScriptTest.java 2010-10-27 21:28:56 UTC (rev 19716)
@@ -23,7 +23,7 @@
import org.richfaces.validator.LibraryFunction;
import org.richfaces.validator.LibraryScriptString;
import org.richfaces.validator.ScriptNotFoundException;
-import org.richfaces.validator.ValidatorDescriptor;
+import org.richfaces.validator.FacesObjectDescriptor;
import com.google.common.collect.Iterables;
@@ -32,7 +32,7 @@
public class RendererGetClientSideScriptTest extends RendererTestBase {
@Mock
- private ValidatorDescriptor descriptor;
+ private FacesObjectDescriptor descriptor;
@Mock
private ConverterDescriptor converterDescriptor;
@@ -43,7 +43,7 @@
@Mock
private LibraryFunction script;
- private Collection<ValidatorDescriptor> descriptors;
+ private Collection<FacesObjectDescriptor> descriptors;
@Before
public void setupService() {
@@ -59,7 +59,7 @@
@Test()
public void testGetClientSideScriptNotExists() throws Throwable {
- expect((Class) descriptor.getValidatorClass()).andReturn(RegexValidator.class);
+ expect((Class) descriptor.getImplementationClass()).andReturn(RegexValidator.class);
expect(scriptService.getScript(RegexValidator.class)).andThrow(new ScriptNotFoundException());
controller.replay();
@@ -71,7 +71,7 @@
@Test(expected = ScriptNotFoundException.class)
public void testGetClientSideConverterScriptNotExists() throws Throwable {
- expect((Class) converterDescriptor.getValidatorClass()).andReturn(NumberConverter.class);
+ expect((Class) converterDescriptor.getImplementationClass()).andReturn(NumberConverter.class);
expect(scriptService.getScript(NumberConverter.class)).andThrow(new ScriptNotFoundException());
controller.replay();
renderer.getClientSideConverterScript(environment.getFacesContext(), converterDescriptor);
@@ -80,9 +80,9 @@
@Test
public void testGetClientSideValidatorScriptFromDescription() throws Exception {
- expect((Class) descriptor.getValidatorClass()).andReturn(RegexValidator.class);
+ expect((Class) descriptor.getImplementationClass()).andReturn(RegexValidator.class);
expect(descriptor.getMessage()).andReturn(VALIDATOR_MESSAGE);
- expect((Map<String, Object>) descriptor.getValidatorParameters()).andReturn(
+ expect((Map<String, Object>) descriptor.getAdditionalParameters()).andReturn(
(Map<String, Object>) VALIDATOR_PARAMS);
expect(scriptService.getScript(RegexValidator.class)).andReturn(script);
expect(script.getName()).andReturn(REGEX_VALIDATOR).atLeastOnce();
@@ -99,9 +99,9 @@
@Test
public void testGetClientSideConverterScriptFromDescription() throws Exception {
- expect((Class) converterDescriptor.getValidatorClass()).andReturn(NumberConverter.class);
+ expect((Class) converterDescriptor.getImplementationClass()).andReturn(NumberConverter.class);
expect(converterDescriptor.getMessage()).andReturn(VALIDATOR_MESSAGE);
- expect((Map<String, Object>) converterDescriptor.getValidatorParameters()).andReturn(
+ expect((Map<String, Object>) converterDescriptor.getAdditionalParameters()).andReturn(
(Map<String, Object>) VALIDATOR_PARAMS);
expect(scriptService.getScript(NumberConverter.class)).andReturn(script);
expect(script.getName()).andReturn(REGEX_VALIDATOR).atLeastOnce();
Modified: branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetComponentScriptTest.java
===================================================================
--- branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetComponentScriptTest.java 2010-10-27 20:58:16 UTC (rev 19715)
+++ branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetComponentScriptTest.java 2010-10-27 21:28:56 UTC (rev 19716)
@@ -12,6 +12,7 @@
import java.util.Collection;
import java.util.Map;
+import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.NumberConverter;
@@ -31,7 +32,7 @@
import org.richfaces.validator.LibraryFunction;
import org.richfaces.validator.LibraryScriptString;
import org.richfaces.validator.ScriptNotFoundException;
-import org.richfaces.validator.ValidatorDescriptor;
+import org.richfaces.validator.FacesObjectDescriptor;
import com.google.common.collect.Lists;
@@ -207,7 +208,7 @@
return createFunction(NUMBER_CONVERTER, ClientValidatorRenderer.VALUE_VAR, VALIDATOR_MESSAGE);
}
- private LibraryScriptFunction createFunction(final String name, String var, String message) {
+ private LibraryScriptFunction createFunction(final String name, String var, FacesMessage validatorMessage) {
LibraryFunction libraryScript = new LibraryFunction() {
@@ -220,7 +221,7 @@
return CLIENT_VALIDATOR_LIBRARY;
}
};
- return new LibraryScriptFunction(libraryScript, new JSLiteral(var), message, VALIDATOR_PARAMS);
+ return new LibraryScriptFunction(libraryScript, new JSLiteral(var), validatorMessage, VALIDATOR_PARAMS);
}
private ClientValidatorRenderer createStubRenderer(final LibraryScriptFunction converterFunction,
@@ -239,7 +240,7 @@
@Override
Collection<? extends LibraryScriptString> getClientSideValidatorScript(FacesContext facesContext,
- Collection<ValidatorDescriptor> validators) {
+ Collection<FacesObjectDescriptor> validators) {
return Lists.newArrayList(validatorFunctions);
}
};
@@ -253,9 +254,9 @@
} else {
expect(mockBehavior.getConverter(behaviorContext)).andStubReturn(null);
}
- ArrayList<ValidatorDescriptor> validatorDescriptors = new ArrayList<ValidatorDescriptor>(validators.length);
+ ArrayList<FacesObjectDescriptor> validatorDescriptors = new ArrayList<FacesObjectDescriptor>(validators.length);
for (Class<?> validator : validators) {
- ValidatorDescriptor validatorDescriptor = controller.createNiceMock(ValidatorDescriptor.class);
+ FacesObjectDescriptor validatorDescriptor = controller.createNiceMock(FacesObjectDescriptor.class);
setupDescription(validator, validatorDescriptor);
validatorDescriptors.add(validatorDescriptor);
}
@@ -263,9 +264,9 @@
expect(input.getClientId(environment.getFacesContext())).andStubReturn("foo:bar");
}
- private void setupDescription(Class<?> converter, ValidatorDescriptor descriptor) {
- expect((Class) descriptor.getValidatorClass()).andStubReturn(converter);
+ private void setupDescription(Class<?> converter, FacesObjectDescriptor descriptor) {
+ expect((Class) descriptor.getImplementationClass()).andStubReturn(converter);
expect(converterDescription.getMessage()).andStubReturn(VALIDATOR_MESSAGE);
- expect((Map) converterDescription.getValidatorParameters()).andStubReturn(VALIDATOR_PARAMS);
+ expect((Map) converterDescription.getAdditionalParameters()).andStubReturn(VALIDATOR_PARAMS);
}
}
Modified: branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererTestBase.java
===================================================================
--- branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererTestBase.java 2010-10-27 20:58:16 UTC (rev 19715)
+++ branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererTestBase.java 2010-10-27 21:28:56 UTC (rev 19716)
@@ -2,6 +2,8 @@
import java.util.Map;
+import javax.faces.application.FacesMessage;
+
import org.jboss.test.faces.mock.Mock;
import org.richfaces.component.behavior.BehaviorTestBase;
import org.richfaces.component.behavior.ClientValidatorBehavior;
@@ -14,7 +16,7 @@
protected static final String CLIENT_VALIDATORS_JS = "clientValidators.js";
protected static final String ORG_RICHFACES = "org.richfaces";
protected static final String REGEX_VALIDATOR = "regexValidator";
- protected static final String VALIDATOR_MESSAGE = "Validator Message";
+ protected static final FacesMessage VALIDATOR_MESSAGE = new FacesMessage("Validator Message");
protected static final Map<String, ? extends Object> VALIDATOR_PARAMS = ImmutableMap.of("foo", "value", "bar", 10);
protected static final LibraryResource CLIENT_VALIDATOR_LIBRARY = new LibraryResource(ORG_RICHFACES, CLIENT_VALIDATORS_JS);
14 years, 3 months
JBoss Rich Faces SVN: r19715 - in branches/RF-8742/ui/validator: ui/src/main/java/org/richfaces/component and 8 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-10-27 16:58:16 -0400 (Wed, 27 Oct 2010)
New Revision: 19715
Added:
branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ValidatorScriptRenderer.java
branches/RF-8742/ui/validator/ui/src/main/resources/META-INF/faces-config.xml
branches/RF-8742/ui/validator/ui/src/test/resources/META-INF/
branches/RF-8742/ui/validator/ui/src/test/resources/META-INF/resources/
branches/RF-8742/ui/validator/ui/src/test/resources/META-INF/resources/foo.bar/
branches/RF-8742/ui/validator/ui/src/test/resources/META-INF/resources/foo.bar/test_script.js
Modified:
branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/LibraryResource.java
branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/component/UIValidatorScript.java
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/TestBean.java
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/UIViewResourceTest.java
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetClientSideScriptTest.java
Log:
RESOLVED - issue RF-9508: UIValidatorScript component test and implementation
https://jira.jboss.org/browse/RF-9508
Modified: branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/LibraryResource.java
===================================================================
--- branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/LibraryResource.java 2010-10-27 19:04:55 UTC (rev 19714)
+++ branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/LibraryResource.java 2010-10-27 20:58:16 UTC (rev 19715)
@@ -87,6 +87,11 @@
}
return true;
}
+
+ @Override
+ public String toString() {
+ return getLibrary()+':'+getResourceName();
+ }
public static Iterable<LibraryResource> of(Iterable<LibraryScriptString> scripts){
LinkedHashSet<LibraryResource> resources = Sets.newLinkedHashSet();
Modified: branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/component/UIValidatorScript.java
===================================================================
--- branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/component/UIValidatorScript.java 2010-10-27 19:04:55 UTC (rev 19714)
+++ branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/component/UIValidatorScript.java 2010-10-27 20:58:16 UTC (rev 19715)
@@ -29,6 +29,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import javax.el.ValueExpression;
import javax.faces.component.NamingContainer;
@@ -43,7 +44,10 @@
import javax.faces.render.Renderer;
import org.richfaces.renderkit.html.ComponentValidatorScript;
+import org.richfaces.renderkit.html.ValidatorScriptRenderer;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterators;
import com.google.common.collect.Lists;
@@ -58,6 +62,75 @@
*/
public class UIValidatorScript extends UIComponent {
+ private final class AttributesMap implements Map<String, Object> {
+ public void clear() {
+ // do nothing
+
+ }
+
+ public boolean containsKey(Object key) {
+
+ return "target".equals(key)||"id".equals(key)||"clientId".equals(key);
+ }
+
+ public boolean containsValue(Object value) {
+ return false;
+ }
+
+ public Set<java.util.Map.Entry<String, Object>> entrySet() {
+ return Collections.emptySet();
+ }
+
+ public Object get(Object key) {
+ if("target".equals(key)){
+ return getTarget();
+ } else if ("id".equals(key)) {
+ return getId();
+ } else if ("clientId".equals(key)) {
+ return getClientId();
+ }
+ return null;
+ }
+
+ public boolean isEmpty() {
+ return false;
+ }
+
+ public Set<String> keySet() {
+ return ImmutableSet.of("target","id","clientId");
+ }
+
+ public Object put(String key, Object value) {
+ if("target".equals(key)){
+ String target = getTarget();
+ setTarget((String) value);
+ return target;
+ } else if ("id".equals(key)) {
+ String id = getId();
+ setId((String) value);
+ return id;
+ }
+ return null;
+ }
+
+ public void putAll(Map<? extends String, ? extends Object> m) {
+
+
+ }
+
+ public Object remove(Object key) {
+ return null;
+ }
+
+ public int size() {
+ return 3;
+ }
+
+ public Collection<Object> values() {
+ return ImmutableList.<Object>of(getTarget(),getId(),getClientId());
+ }
+ }
+
public static final String COMPONENT_TYPE = "org.richfaces.ValidatroScript";
public static final String COMPONENT_FAMILY = "org.richfaces.Script";
@@ -66,6 +139,8 @@
private UIComponent parent;
private String target="form";
private final List<ComponentValidatorScript> scripts = Lists.newArrayList();
+
+ private final Map<String, Object> attributesMap = new AttributesMap();
private String clientId;
@@ -117,7 +192,7 @@
@Override
public Map<String, Object> getAttributes() {
- return Collections.emptyMap();
+ return attributesMap;
}
@Override
@@ -229,8 +304,7 @@
@Override
public String getRendererType() {
- // TODO Auto-generated method stub
- return null;
+ return ValidatorScriptRenderer.RENDERER_TYPE;
}
@Override
Added: branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ValidatorScriptRenderer.java
===================================================================
--- branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ValidatorScriptRenderer.java (rev 0)
+++ branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ValidatorScriptRenderer.java 2010-10-27 20:58:16 UTC (rev 19715)
@@ -0,0 +1,73 @@
+/**
+ *
+ */
+package org.richfaces.renderkit.html;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.LinkedHashSet;
+
+import javax.faces.FacesException;
+import javax.faces.application.Resource;
+import javax.faces.application.ResourceHandler;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.render.Renderer;
+
+import org.richfaces.component.UIValidatorScript;
+import org.richfaces.validator.LibraryResource;
+
+import com.google.common.collect.Sets;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class ValidatorScriptRenderer extends Renderer {
+
+ public static final String RENDERER_TYPE = "org.richfaces.renderer.ValidatorScriptRenderer";
+ private static final String TEXT_JAVASCRIPT = "text/javascript";
+ private static final String SRC = "src";
+ private static final String TYPE = "type";
+ private static final String SCRIPT = "script";
+
+ @Override
+ public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
+ UIValidatorScript validatorScript = (UIValidatorScript) component;
+
+ Collection<ComponentValidatorScript> scripts = validatorScript.getScripts();
+ // flatten all dependent resources.
+ LinkedHashSet<LibraryResource> resources = Sets.newLinkedHashSet();
+ for (ComponentValidatorScript script : scripts) {
+ resources.addAll(script.getResources());
+ }
+ // render dependencies
+ for (LibraryResource resource : resources) {
+ encodeResource(context, resource);
+ }
+ ResponseWriter responseWriter = context.getResponseWriter();
+ responseWriter.startElement(SCRIPT, null);
+ responseWriter.writeAttribute(TYPE, TEXT_JAVASCRIPT, null);
+ for (ComponentValidatorScript componentValidatorScript : scripts) {
+ responseWriter.writeText(componentValidatorScript.toScript(), null);
+ responseWriter.write('\n');
+ }
+ responseWriter.endElement(SCRIPT);
+ }
+
+ private void encodeResource(FacesContext context, LibraryResource resource) throws IOException {
+ ResourceHandler resourceHandler = context.getApplication().getResourceHandler();
+ Resource jsfResource = resourceHandler.createResource(resource.getResourceName(), resource.getLibrary());
+ if (null != jsfResource) {
+ ResponseWriter responseWriter = context.getResponseWriter();
+ responseWriter.startElement(SCRIPT, null);
+ responseWriter.writeAttribute(TYPE, TEXT_JAVASCRIPT, null);
+ responseWriter.writeURIAttribute(SRC, jsfResource.getRequestPath(), null);
+ responseWriter.endElement(SCRIPT);
+ } else {
+ throw new FacesException("Dependent resource "+resource.toString()+ " not found");
+ }
+ }
+
+}
Property changes on: branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ValidatorScriptRenderer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: branches/RF-8742/ui/validator/ui/src/main/resources/META-INF/faces-config.xml
===================================================================
--- branches/RF-8742/ui/validator/ui/src/main/resources/META-INF/faces-config.xml (rev 0)
+++ branches/RF-8742/ui/validator/ui/src/main/resources/META-INF/faces-config.xml 2010-10-27 20:58:16 UTC (rev 19715)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faces-config version="2.0" metadata-complete="false" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:cdk="http://jboss.org/schema/richfaces/cdk/extensions" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<component>
+ <component-type>org.richfaces.ValidatroScript</component-type>
+ <component-class>org.richfaces.component.UIValidatorScript</component-class>
+</component>
+<render-kit>
+ <renderer>
+ <component-family>org.richfaces.Script</component-family>
+ <renderer-type>org.richfaces.renderer.ValidatorScriptRenderer</renderer-type>
+ <renderer-class>org.richfaces.renderkit.html.ValidatorScriptRenderer</renderer-class>
+ </renderer>
+</render-kit>
+</faces-config>
\ No newline at end of file
Property changes on: branches/RF-8742/ui/validator/ui/src/main/resources/META-INF/faces-config.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/TestBean.java
===================================================================
--- branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/TestBean.java 2010-10-27 19:04:55 UTC (rev 19714)
+++ branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/TestBean.java 2010-10-27 20:58:16 UTC (rev 19715)
@@ -3,14 +3,56 @@
*/
package org.richfaces.component;
+import java.util.Collection;
+import java.util.Collections;
+
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.renderkit.html.ComponentValidatorScript;
+import org.richfaces.validator.LibraryResource;
+
/**
* @author asmirnov
*
*/
public class TestBean {
+ public static final String TEST_SCRIPT_NAME = "test_script";
+
+ public static final String FOO_BAR = "foo.bar";
+
+ public static final String FOO = "foo";
+
public static final String FOO_VALUE = "fooValue";
+ public static final String TEST_SCRIPT = "function " + FOO + "(id){alert(id);}";
+
+ private static final LibraryResource TEST_RESOURCE = new LibraryResource(FOO_BAR, TEST_SCRIPT_NAME + ".js");
+
+ private static final ComponentValidatorScript SCRIPT = new ComponentValidatorScript() {
+
+ public String toScript() {
+ return TEST_SCRIPT;
+ }
+
+ public void appendScript(StringBuffer functionString) {
+ functionString.append(TEST_SCRIPT);
+ }
+
+ public Collection<LibraryResource> getResources() {
+ return Collections.singleton(TEST_RESOURCE);
+ }
+
+ public String getName() {
+ return FOO;
+ }
+
+ public String createCallScript(String clientId) {
+ return FOO+"("+clientId+")";
+ }
+ };
+
private String value=FOO_VALUE;
/**
@@ -27,6 +69,14 @@
this.value = value;
}
+ public String action() {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ UIViewRoot viewRoot = facesContext.getViewRoot();
+ UIValidatorScript resource = (UIValidatorScript) facesContext.getApplication().createComponent(UIValidatorScript.COMPONENT_TYPE);
+ resource.addOrFindScript(SCRIPT );
+ viewRoot.addComponentResource(facesContext, resource);
+ return null;
+ }
}
Modified: branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/UIViewResourceTest.java
===================================================================
--- branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/UIViewResourceTest.java 2010-10-27 19:04:55 UTC (rev 19714)
+++ branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/UIViewResourceTest.java 2010-10-27 20:58:16 UTC (rev 19715)
@@ -1,8 +1,10 @@
package org.richfaces.component;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
-import javax.faces.render.ResponseStateManager;
+import java.net.MalformedURLException;
import org.jboss.test.faces.FacesEnvironment;
import org.jboss.test.faces.FacesEnvironment.FacesRequest;
@@ -29,6 +31,7 @@
" xmlns:h=\"http://java.sun.com/jsf/html\">"+
"<h:form id=\"helloForm\" >"+
" <h:inputText id=\"input\" value=\"#{test.value}\" />\n" +
+ " <h:commandButton id=\"command\" value=\"Ok\" action=\"#{test.action}\"/>\n" +
"</h:form>\n" +
"</html>").
withResource(FacesEnvironment.FACES_CONFIG_XML, "org/richfaces/component/faces-config.xml").
@@ -46,15 +49,22 @@
FacesRequest request = environment.createFacesRequest("http://localhost/test.jsf?foo=bar");
assertNotNull(request.execute());
String contentAsString = request.getConnection().getContentAsString();
- assertTrue(contentAsString.contains(ResponseStateManager.VIEW_STATE_PARAM));
- assertTrue(contentAsString.contains(TestBean.FOO_VALUE));
- FacesRequest request2 = request.submit().withParameter("helloForm:input", "BAZ");
+ assertFalse(contentAsString.contains(TestBean.TEST_SCRIPT));
+ FacesRequest request2 = submit(request).submit();
request2.execute();
String content2 = request2.getConnection().getContentAsString();
- assertTrue(content2.contains("BAZ"));
- assertFalse(content2.contains(TestBean.FOO_VALUE));
-
+ assertFalse(content2.contains(TestBean.TEST_SCRIPT));
}
+ private FacesRequest submit(FacesRequest request) throws MalformedURLException {
+ FacesRequest request2 = request.submit().withParameter("helloForm:input", "BAZ").withParameter("helloForm:command", "Ok");
+ request2.execute();
+ String content2 = request2.getConnection().getContentAsString();
+ assertTrue(content2.contains(TestBean.TEST_SCRIPT));
+ assertTrue(content2.contains(TestBean.TEST_SCRIPT_NAME));
+ assertTrue(content2.contains(TestBean.FOO_BAR));
+ return request2;
+ }
+
}
Modified: branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetClientSideScriptTest.java
===================================================================
--- branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetClientSideScriptTest.java 2010-10-27 19:04:55 UTC (rev 19714)
+++ branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetClientSideScriptTest.java 2010-10-27 20:58:16 UTC (rev 19715)
@@ -85,7 +85,7 @@
expect((Map<String, Object>) descriptor.getValidatorParameters()).andReturn(
(Map<String, Object>) VALIDATOR_PARAMS);
expect(scriptService.getScript(RegexValidator.class)).andReturn(script);
- expect(script.getName()).andReturn(REGEX_VALIDATOR);
+ expect(script.getName()).andReturn(REGEX_VALIDATOR).atLeastOnce();
expect(script.getResource()).andReturn(CLIENT_VALIDATOR_LIBRARY);
controller.replay();
Collection<? extends LibraryScriptString> clientSideScripts = renderer.getClientSideValidatorScript(environment.getFacesContext(), descriptors);
@@ -104,7 +104,7 @@
expect((Map<String, Object>) converterDescriptor.getValidatorParameters()).andReturn(
(Map<String, Object>) VALIDATOR_PARAMS);
expect(scriptService.getScript(NumberConverter.class)).andReturn(script);
- expect(script.getName()).andReturn(REGEX_VALIDATOR);
+ expect(script.getName()).andReturn(REGEX_VALIDATOR).atLeastOnce();
expect(script.getResource()).andReturn(CLIENT_VALIDATOR_LIBRARY);
controller.replay();
LibraryScriptFunction clientSideScript =
Added: branches/RF-8742/ui/validator/ui/src/test/resources/META-INF/resources/foo.bar/test_script.js
===================================================================
Property changes on: branches/RF-8742/ui/validator/ui/src/test/resources/META-INF/resources/foo.bar/test_script.js
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 3 months
JBoss Rich Faces SVN: r19713 - in sandbox/trunk/ui/calendar/ui/src/main: java/org/richfaces/renderkit and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-10-27 14:18:59 -0400 (Wed, 27 Oct 2010)
New Revision: 19713
Modified:
sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/component/AbstractCalendar.java
sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar-utils.js
sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.ecss
sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.js
sandbox/trunk/ui/calendar/ui/src/main/templates/calendar.template.xml
Log:
fix template, fix properties passing to javascript, client calendar js simple fixes
Modified: sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/component/AbstractCalendar.java
===================================================================
--- sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/component/AbstractCalendar.java 2010-10-27 18:15:07 UTC (rev 19712)
+++ sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/component/AbstractCalendar.java 2010-10-27 18:18:59 UTC (rev 19713)
@@ -69,10 +69,10 @@
public static final String TIME_PATTERN = "HH:mm";
- public static final String DEFAULT_DATE_PATTERN = "MMM d, YYYY";
+ public static final String DEFAULT_DATE_PATTERN = "MMM d, yyyy";
- @Attribute(defaultValue="MMM d, YYYY")
+ @Attribute(defaultValue="MMM d, yyyy")
public abstract String getDatePattern();
@Attribute(defaultValue="getDefaultLocale()")
Modified: sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
===================================================================
--- sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2010-10-27 18:15:07 UTC (rev 19712)
+++ sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2010-10-27 18:18:59 UTC (rev 19713)
@@ -24,6 +24,8 @@
import java.io.IOException;
import java.text.DateFormatSymbols;
+import java.text.Format;
+import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
@@ -123,6 +125,10 @@
public static final String OPTION_DEFAULT_TIME = "defaultTime";
+ public static final String OPTION_HIDE_POPUP_ON_SCROLL = "hidePopupOnScroll";
+
+ public static final String OPTION_SHOW_WEEK_DAYS_BAR = "showWeekDaysBar";
+
public static final String MONTH_LABELS_SHORT = "monthLabelsShort";
public static final String MONTH_LABELS = "monthLabels";
@@ -134,6 +140,8 @@
public static final String FIRST_DAY_WEEK = "firstWeekDay";
public static final String MIN_DAYS_IN_FIRST_WEEK = "minDaysInFirstWeek";
+
+
protected static final Map<String, ComponentAttribute> CALENDAR_INPUT_HANDLER_ATTRIBUTES = Collections.unmodifiableMap(ComponentAttribute.createMap(
@@ -260,6 +268,13 @@
return formatDate(date);
}
+ public String getCurrentDateAsString(FacesContext context, AbstractCalendar calendar) throws IOException {
+ Format formatter = new SimpleDateFormat("MM/yyyy");
+
+ Date currentDate = calendar.getCurrentDateOrDefault();
+ return formatter.format(currentDate);
+ }
+
public static Object formatDate(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
@@ -481,38 +496,38 @@
ScriptOptions scriptOptions = new ScriptOptions(component);
scriptOptions.addOption(OPTION_ENABLE_MANUAL_INPUT);
- scriptOptions.addOption("disabled");
- scriptOptions.addOption("readonly");
- scriptOptions.addOption("resetTimeOnDateSelect");
- scriptOptions.addOption("showApplyButton");
- scriptOptions.addOption("styleClass");
- scriptOptions.addOption("popup");
- scriptOptions.addOption("showInput");
- scriptOptions.addOption("showHeader");
- scriptOptions.addOption("showFooter");
- scriptOptions.addOption("showWeeksBar");
- scriptOptions.addOption("showWeekDaysBar");
- scriptOptions.addOption("todayControlMode");
- scriptOptions.addOption("datePattern");
- scriptOptions.addOption("jointPoint");
- scriptOptions.addOption("direction");
- scriptOptions.addOption("boundaryDatesMode");
- scriptOptions.addOption("horizontalOffset");
- scriptOptions.addOption("verticalOffset");
- scriptOptions.addOption("hidePopupOnScroll");
-
- scriptOptions.addOption("currentDate", getCurrentDate(facesContext, calendar));
- scriptOptions.addOption("selectedDate", getSelectedDate(facesContext, calendar));
- scriptOptions.addOption("style", HtmlUtil.concatStyles("z-index: " + calendar.getZindex(), calendar.getStyle()));
- scriptOptions.addOption("submitFunction", getSubmitFunction(facesContext, calendar));
- scriptOptions.addOption("dayCellClass", getDayCellClass(facesContext, calendar));
- scriptOptions.addOption("dayStyleClass", getDayStyleClass(facesContext, calendar));
+ scriptOptions.addOption(OPTION_DISABLED);
+ scriptOptions.addOption(OPTION_READONLY);
+ scriptOptions.addOption(OPTION_RESET_TIME_ON_DATE_SELECT);
+ scriptOptions.addOption(OPTION_SHOW_APPLY_BUTTON);
+ scriptOptions.addOption(OPTION_POPUP);
+ scriptOptions.addOption(OPTION_SHOW_INPUT);
+ scriptOptions.addOption(OPTION_SHOW_HEADER);
+ scriptOptions.addOption(OPTION_SHOW_FOOTER);
+ scriptOptions.addOption(OPTION_SHOW_WEEKS_BAR);
+ scriptOptions.addOption(OPTION_TODAY_CONTROL_MODE);
+ scriptOptions.addOption(OPTION_DATE_PATTERN);
+ scriptOptions.addOption(OPTION_JOINT_POINT);
+ scriptOptions.addOption(OPTION_DIRECTION);
+ scriptOptions.addOption(OPTION_BOUNDARY_DATES_MODE);
+ scriptOptions.addOption(OPTION_HORIZONTAL_OFFSET);
+ scriptOptions.addOption(OPTION_VERTICAL_OFFSET);
+ scriptOptions.addOption(OPTION_CURRENT_DATE, getCurrentDate(facesContext, calendar));
+ scriptOptions.addOption(OPTION_SELECTED_DATE, getSelectedDate(facesContext, calendar));
+ scriptOptions.addOption(OPTION_SUBMIT_FUNCTION, getSubmitFunction(facesContext, calendar));
+ scriptOptions.addOption(OPTION_DAY_CELL_CLASS, getDayCellClass(facesContext, calendar));
+ scriptOptions.addOption(OPTION_DAY_STYLE_CLASS, getDayStyleClass(facesContext, calendar));
/*
*add to script option
*<cdk:scriptOption attributes="ondateselected, ondateselect, ontimeselect, ontimeselected, onchanged, ondatemouseover, ondatemouseout, onexpand, oncollapse, oncurrentdateselect, oncurrentdateselected" wrapper="eventHandler" />
* */
- scriptOptions.addOption("labels", getLabels(facesContext, calendar));
- scriptOptions.addOption("defaultTime", getPreparedDefaultTime(calendar));
+ scriptOptions.addOption(OPTION_LABELS, getLabels(facesContext, calendar));
+ scriptOptions.addOption(OPTION_DEFAULT_TIME, getPreparedDefaultTime(calendar));
+ scriptOptions.addOption(OPTION_HIDE_POPUP_ON_SCROLL);
+ scriptOptions.addOption("showWeekDaysBar");
+
+ scriptOptions.addOption("styleClass");
+ scriptOptions.addOption("style", HtmlUtil.concatStyles("z-index: " + calendar.getZindex(), calendar.getStyle()));
return scriptOptions;
}
Modified: sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar-utils.js
===================================================================
--- sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar-utils.js 2010-10-27 18:15:07 UTC (rev 19712)
+++ sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar-utils.js 2010-10-27 18:18:59 UTC (rev 19713)
@@ -161,7 +161,7 @@
yy += Math.floor(defaultCenturyStartYear/100)*100 + (yy < ambiguousTwoDigitYear ? 100 : 0);
}
- var mm = parseInt(match[m],10); if (isNaN(mm)) mm = Richfaces.Calendar.getMonthByLabel(match[m], shortLabel ? monthNamesShort : monthNames); else if (--mm<0 || mm>11) return null;
+ var mm = parseInt(match[m],10); if (isNaN(mm)) mm = this.getMonthByLabel(match[m], shortLabel ? monthNamesShort : monthNames); else if (--mm<0 || mm>11) return null;
var addDay = correctYear ? 1 : 0;
var dd = parseInt(match[d],10); if (isNaN(dd) || dd<1 || dd>this.daysInMonth(yy, mm) + addDay) return null;
Modified: sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.ecss
===================================================================
--- sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.ecss 2010-10-27 18:15:07 UTC (rev 19712)
+++ sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.ecss 2010-10-27 18:18:59 UTC (rev 19713)
@@ -354,9 +354,9 @@
.rich-calendar-editor-layout-shadow {
background-color: '#{richSkin.shadowBackgroundColor}';
+ position: absolute;
opacity: 0.3;
filter: alpha(opacity=30);
- position: absolute;
}
.rich-calendar-editor-btn {
Modified: sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.js
===================================================================
--- sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.js 2010-10-27 18:15:07 UTC (rev 19712)
+++ sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.js 2010-10-27 18:18:59 UTC (rev 19713)
@@ -281,7 +281,7 @@
// optionalHeaderMarkup - user defined header (optional)
// optionalFooterMarkup - user defined footer (optional)
- // currentDate - date to show month (day not used) (mm/yyyy)
+ // currentDate - date to show month (day not used) (MM/yyyy)
// selectedDate - selected date (mm/dd/yyyy)
// weekDayLabels - collection of week day labels keyed by week day numbers
// weekDayLabelsShort - collection of week day short labels keyed by week day numbers
Modified: sandbox/trunk/ui/calendar/ui/src/main/templates/calendar.template.xml
===================================================================
--- sandbox/trunk/ui/calendar/ui/src/main/templates/calendar.template.xml 2010-10-27 18:15:07 UTC (rev 19712)
+++ sandbox/trunk/ui/calendar/ui/src/main/templates/calendar.template.xml 2010-10-27 18:18:59 UTC (rev 19713)
@@ -59,7 +59,7 @@
</c:choose>
</c:otherwise>
</c:choose>
- <input type="hidden" id="#{clientId}InputCurrentDate" style="display:none" autocomplete="off" name="#{clientId}InputCurrentDate" value="#{component.attributes['currentDate']}" />
+ <input type="hidden" id="#{clientId}InputCurrentDate" style="display:none" autocomplete="off" name="#{clientId}InputCurrentDate" value="getCurrentDateAsString(facesContext, component)" />
</span>
<div style="display: none;" id="#{clientId}"></div>
14 years, 3 months
JBoss Rich Faces SVN: r19712 - in trunk/ui/input/ui/src: main/java/org/richfaces/renderkit and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-10-27 14:15:07 -0400 (Wed, 27 Oct 2010)
New Revision: 19712
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js
trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml
trunk/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceSelectRendererTest.java
Log:
add saveOnSelect attribute, fix openOnEdit behavior, fix IE bugs
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java 2010-10-27 17:53:45 UTC (rev 19711)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java 2010-10-27 18:15:07 UTC (rev 19712)
@@ -50,8 +50,11 @@
@Attribute(defaultValue="InplaceState.ready")
public abstract InplaceState getState();
- @Attribute(defaultValue="false")
+ @Attribute(defaultValue="true")
public abstract boolean isOpenOnEdit();
+
+ @Attribute(defaultValue="true")
+ public abstract boolean isSaveOnSelect();
@Attribute(defaultValue="true")
public abstract boolean isSaveOnBlur();
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java 2010-10-27 17:53:45 UTC (rev 19711)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java 2010-10-27 18:15:07 UTC (rev 19712)
@@ -58,8 +58,10 @@
@ResourceDependency(library = "org.richfaces", name = "inplaceSelect.ecss") })
public class InplaceSelectRendererBase extends InplaceInputRendererBase {
- public static final String OPTIONS_VISIBLE = "visible";
+ public static final String OPTIONS_OPEN_ON_EDIT = "openOnEdit";
+ public static final String OPTIONS_SAVE_ON_SELECT = "saveOnSelect";
+
public static final String ITEM_CSS = "rf-is-opt";
public static final String SELECT_ITEM_CSS = "rf-is-sel";
@@ -98,8 +100,11 @@
AbstractSelect abstractSelect = (AbstractSelect)component;
SelectHelper.addSelectCssToOptions(abstractSelect, options, new String[] {ITEM_CSS, SELECT_ITEM_CSS, LIST_CSS});
boolean openOnEdit = (Boolean)component.getAttributes().get("openOnEdit");
+ boolean saveOnSelect = (Boolean)component.getAttributes().get("saveOnSelect");
if(openOnEdit) {
- options.put(OPTIONS_VISIBLE, openOnEdit);
+ options.put(OPTIONS_OPEN_ON_EDIT, openOnEdit);
+ options.put(OPTIONS_SAVE_ON_SELECT, saveOnSelect);
+
}
options.put(SelectHelper.OPTIONS_LIST_ITEMS, additional);
}
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js 2010-10-27 17:53:45 UTC (rev 19711)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js 2010-10-27 18:15:07 UTC (rev 19712)
@@ -11,6 +11,7 @@
this.initialValue = (labelText == inputLabel) ? labelText : "";
this.saveOnBlur = mergedOptions.saveOnBlur;
this.showControls = mergedOptions.showControls;
+ this.__proxie
this.getInput().bind("focus", $.proxy(this.__editHandler, this));
if(this.showControls) {
@@ -72,6 +73,7 @@
} else {
this.__hide();
}
+ this.getInput().bind("focus", $.proxy(this.__editHandler, this));
},
__blurHandler: function(e) {
@@ -91,7 +93,6 @@
__setInputFocus: function() {
this.getInput().unbind("focus", this.__editHandler);
this.getInput().focus();
- this.getInput().bind("focus", $.proxy(this.__editHandler, this));
},
__saveBtnHandler: function(e) {
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js 2010-10-27 17:53:45 UTC (rev 19711)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js 2010-10-27 18:15:07 UTC (rev 19712)
@@ -11,7 +11,8 @@
this.selValueInput = $(document.getElementById(id+"selValue"));
this.list = $(document.getElementById(id+"List"));
this.list.bind("click", $.proxy(this.__onListClick, this));
- this.openPopup = false;
+ this.openOnEdit = options.openOnEdit;
+ this.saveOnSelect = options.saveOnSelect;
}
rf.ui.InplaceInput.extend(rf.ui.InplaceSelect);
@@ -41,23 +42,25 @@
geNamespace: function() {
return this.namespace;
},
-
+
onshow: function() {
- if(this.openPopup) {
- this.popupList.show();
+ $super.onshow.call(this);
+ if(this.openOnEdit) {
+ this.showPopup();
}
-
- if(!this.openPopup) {
- this.openPopup = true;
- }
-
- $super.onshow.call(this);
- },
+ },
onhide: function() {
+ this.hidePopup();
+ },
+
+ showPopup: function() {
+ this.popupList.show();
+ },
+
+ hidePopup: function() {
this.popupList.hide();
- this.openPopup = false;
- },
+ },
processItem: function(item) {
var key = $(item).attr("id");
@@ -65,10 +68,11 @@
this.saveItemValue(value);
var label = this.getItemLabel(key);
this.setValue(label);
-
- this.popupList.hide();
- this.openPopup = false;
this.__setInputFocus();
+ this.hidePopup();
+ if(this.saveOnSelect) {
+ this.save();
+ }
},
getItemValue: function(key) {
@@ -132,11 +136,15 @@
__blurHandler: function(e) {
if(this.isEditState()) {
this.timeoutId = window.setTimeout($.proxy(function(){
- this.popupList.hide();
+ this.hidePopup();
this.__handleBlur();
}, this), 200);
}
},
+
+ __clickHandler: function(e) {
+ this.showPopup();
+ },
__onListClick: function(e) {
window.clearTimeout(this.timeoutId);
Modified: trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml
===================================================================
--- trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2010-10-27 17:53:45 UTC (rev 19711)
+++ trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2010-10-27 18:15:07 UTC (rev 19712)
@@ -78,7 +78,7 @@
</span>
</span>
</c:if>
- <span id="#{clientId}List" style="#{component.attributes['openOnEdit'] ? '' : 'display: none'}" class="rf-is-lst-cord">
+ <span id="#{clientId}List" style="display: none" class="rf-is-lst-cord">
<cdk:call expression="renderListHandlers(facesContext, component);"/>
<span class="rf-is-lst-pos" style="width: #{component.attributes['listWidth']}">
<span class="rf-is-shdw">
Modified: trunk/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceSelectRendererTest.java
===================================================================
--- trunk/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceSelectRendererTest.java 2010-10-27 17:53:45 UTC (rev 19711)
+++ trunk/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceSelectRendererTest.java 2010-10-27 18:15:07 UTC (rev 19712)
@@ -2,20 +2,18 @@
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
-
-
import java.io.IOException;
+import org.junit.Ignore;
import org.junit.Test;
import org.xml.sax.SAXException;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
-import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
@@ -47,10 +45,11 @@
}
@Test
+ @Ignore
public void testEdit() throws Exception {
HtmlPage page = environment.getPage("/inplaceSelectTest.jsf");
String defaultComponentId = BASE_ID + DEFAULT;
- edit(page, defaultComponentId, 2);
+ edit(page, defaultComponentId, 1);
HtmlElement input = page.getFirstByXPath("//*[@id = '" + defaultComponentId + "Input']");
assertNotNull(input);
@@ -70,20 +69,15 @@
HtmlElement list = page.getFirstByXPath("//*[@id = '" + inplaceSelectId + "List']");
assertNotNull(list);
- assertFalse(list.isDisplayed());
-
- span = page.getFirstByXPath("//*[@id = '" + inplaceSelectId + "']");
- assertNotNull(span);
- span.click();
-
- list = page.getFirstByXPath("//*[@id = '" + inplaceSelectId + "List']");
- assertNotNull(list);
assertTrue(list.isDisplayed());
HtmlElement item = page.getFirstByXPath("//*[@id = '" + inplaceSelectId + "Item"+selectIndex+"']");
assertNotNull(item);
item.click();
+ HtmlElement panel = page.getFirstByXPath("//*[@id = 'form:out']");
+ panel.click();
+
list = page.getFirstByXPath("//*[@id = '" + inplaceSelectId + "List']");
assertNotNull(list);
assertFalse(list.isDisplayed());
14 years, 3 months
JBoss Rich Faces SVN: r19711 - in trunk/ui: common/ui/src/main/resources/META-INF/resources and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-10-27 13:53:45 -0400 (Wed, 27 Oct 2010)
New Revision: 19711
Added:
trunk/ui/common/ui/src/main/resources/META-INF/resources/
trunk/ui/common/ui/src/main/resources/META-INF/resources/org.richfaces/
trunk/ui/common/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js
Removed:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js
Log:
move popup to common ui and clean up
Copied: trunk/ui/common/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js (from rev 19665, trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js)
===================================================================
--- trunk/ui/common/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js (rev 0)
+++ trunk/ui/common/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js 2010-10-27 17:53:45 UTC (rev 19711)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.
+ */
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.Popup = function(id, options) {
+ this.id = id;
+ this.popup = $(document.getElementById(id));
+
+ var mergedOptions = $.extend({}, defaultOptions, options);
+ this.visible = mergedOptions.visible;
+ this.attachTo = mergedOptions.attachTo;
+ this.attachToBody = mergedOptions.attachToBody;
+ this.positionType = mergedOptions.positionType;
+ this.positionOffset = mergedOptions.positionOffset;
+ };
+
+ rf.BaseComponent.extend(rf.ui.Popup);
+ var $super = rf.ui.Popup.$super;
+
+
+ var defaultOptions = {
+ visible: false
+ };
+
+ $.extend(rf.ui.Popup.prototype, {
+
+ name : "popup",
+
+ show: function(event) {
+ if (!this.visible) {
+ if (this.attachToBody) {
+ this.parentElement = this.popup.parent();
+ this.popup.detach().appendTo("body");
+ }
+ this.visible = true;
+ }
+
+ this.popup.setPosition(event || {id: this.attachTo}, {type: this.positionType , offset: this.positionOffset}).show();
+ },
+
+ hide: function() {
+ if (this.visible) {
+ this.popup.hide();
+ this.visible = false;
+ if (this.attachToBody && this.parentElement) {
+ this.popup.detach().appendTo(this.parentElement);
+ this.parentElement = null;
+ }
+ }
+ },
+
+ isVisible: function() {
+ return this.visible;
+ },
+
+ getId: function() {
+ return this.id;
+ }
+ });
+
+})(jQuery, window.RichFaces);
\ No newline at end of file
Deleted: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js 2010-10-27 17:52:44 UTC (rev 19710)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js 2010-10-27 17:53:45 UTC (rev 19711)
@@ -1,83 +0,0 @@
-(function ($, rf) {
-
- rf.ui = rf.ui || {};
-
- rf.ui.Popup = function(id, options) {
- this.id = id;
- this.attachToDom(id);
- this.popup = $(document.getElementById(id));
-
- var mergedOptions = $.extend({}, defaultOptions, options);
- this.visible = mergedOptions.visible;
- this.attachTo = mergedOptions.attachTo;
- this.attachToBody = mergedOptions.attachToBody;
- this.positionType = mergedOptions.positionType;
- this.positionOffset = mergedOptions.positionOffset;
-
- this.popup.bind("mouseover", $.proxy(this.__onMouseOver, this));
- this.popup.bind("click", $.proxy(this.__onClick, this));
- };
-
- rf.BaseComponent.extend(rf.ui.Popup);
- var $super = rf.ui.Popup.$super;
-
-
- var defaultOptions = {
- visible: false
- };
-
- $.extend(rf.ui.Popup.prototype, (function () {
-
- return{
-
- name : "popup",
-
- show: function() {
- if(!this.visible) {
- if(this.attachToBody) {
- this.parentElement = this.popup.parent();
- this.popup.detach().appendTo("body");
- }
- this.popup.setPosition({id: this.attachTo}, {type: this.positionType , offset: this.positionOffset}).show();
- this.visible = true;
- this.__onShow();
- }
- },
-
- hide: function() {
- if(this.visible) {
- this.popup.hide();
- this.visible = false;
- if (this.attachToBody && this.parentElement) {
- this.popup.detach().appendTo(this.parentElement);
- this.parentElement = null;
- }
- this.__onHide();
- }
- },
-
- isVisible: function() {
- return this.visible;
- },
-
- getId: function() {
- return this.id;
- },
-
- __onMouseOver: function(e) {
- },
-
- __onClick: function(e) {
- },
-
- __onHide: function() {
- },
-
- __onShow: function() {
-
- }
- }
-
- })());
-
-})(jQuery, window.RichFaces);
\ No newline at end of file
14 years, 3 months
JBoss Rich Faces SVN: r19710 - in branches/RF-8742/ui/validator/ui/src: test/java/org/richfaces/convert and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2010-10-27 13:52:44 -0400 (Wed, 27 Oct 2010)
New Revision: 19710
Added:
branches/RF-8742/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/boolean-converter.js
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/convert/BooleanConverterTest.java
Modified:
branches/RF-8742/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/byte-converter.js
branches/RF-8742/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/number-converter.js
branches/RF-8742/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/richfaces-csv.js
branches/RF-8742/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/short-converter.js
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/convert/ByteConverterTest.java
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/convert/ShortConverterTest.java
Log:
https://jira.jboss.org/browse/RF-9521https://jira.jboss.org/browse/RF-9521
boolean converter was added
+some fixes
Added: branches/RF-8742/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/boolean-converter.js
===================================================================
--- branches/RF-8742/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/boolean-converter.js (rev 0)
+++ branches/RF-8742/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/boolean-converter.js 2010-10-27 17:52:44 UTC (rev 19710)
@@ -0,0 +1,10 @@
+RichFaces.csv.addConverter({"boolean":
+(function($, rf) {
+ return function (value, params) {
+ var result; value = $.trim(value).toLowerCase();
+ result = value=='true' ? true : value.length<1 ? null : false;
+
+ return result;
+ }
+})(jQuery, window.RichFaces || (window.RichFaces={}))
+});
\ No newline at end of file
Modified: branches/RF-8742/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/byte-converter.js
===================================================================
--- branches/RF-8742/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/byte-converter.js 2010-10-27 16:56:42 UTC (rev 19709)
+++ branches/RF-8742/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/byte-converter.js 2010-10-27 17:52:44 UTC (rev 19710)
@@ -1,11 +1,11 @@
RichFaces.csv.addConverter({"byte":
-(function(rf) {
+(function($, rf) {
return function (value, params) {
- var result = parseInt(value);
- if (isNaN(result) || result<-128 || result>127) {
+ var result; value = $.trim(value);
+ if (!rf.csv.RE_DIGITS.test(value) || (result=parseInt(value,10))<-128 || result>127) {
throw rf.csv.getMessage(params.customMessage, 'BYTE_CONVERTER_BYTE', [value, 0, params.componentId]);
}
return result;
}
-})(window.RichFaces || (window.RichFaces={}))
+})(jQuery, window.RichFaces || (window.RichFaces={}))
});
\ No newline at end of file
Modified: branches/RF-8742/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/number-converter.js
===================================================================
--- branches/RF-8742/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/number-converter.js 2010-10-27 16:56:42 UTC (rev 19709)
+++ branches/RF-8742/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/number-converter.js 2010-10-27 17:52:44 UTC (rev 19710)
@@ -1,7 +1,7 @@
RichFaces.csv.addConverter({"number":
-(function(rf) {
+(function($, rf) {
return function (value, params) {
- var result;
+ var result; value=$.trim(value);
if (isNaN(value)) {
throw rf.csv.getMessage(params.customMessage, 'NUMBER_CONVERTER_NUMBER', [value, 0, params.componentId]);
} else {
@@ -9,5 +9,5 @@
}
return result;
}
-})(window.RichFaces || (window.RichFaces={}))
+})(jQuery, window.RichFaces || (window.RichFaces={}))
});
\ No newline at end of file
Modified: branches/RF-8742/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/richfaces-csv.js
===================================================================
--- branches/RF-8742/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/richfaces-csv.js 2010-10-27 16:56:42 UTC (rev 19709)
+++ branches/RF-8742/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/richfaces-csv.js 2010-10-27 17:52:44 UTC (rev 19710)
@@ -9,6 +9,7 @@
var RE_MESSAGE_PATTERN = /\{(\d+)\}/g;
$.extend(rf.csv, {
+ RE_DIGITS: /^-?\d+$/,
MESSAGE_EVENT_NAME: "onmessage."+rf.Event.RICH_NAMESPACE,
// Messages API
addMessage: function (messagesObject) {
Modified: branches/RF-8742/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/short-converter.js
===================================================================
--- branches/RF-8742/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/short-converter.js 2010-10-27 16:56:42 UTC (rev 19709)
+++ branches/RF-8742/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/short-converter.js 2010-10-27 17:52:44 UTC (rev 19710)
@@ -1,11 +1,11 @@
-RichFaces.csv.addConverter({"byte":
-(function(rf) {
+RichFaces.csv.addConverter({"short":
+(function($, rf) {
return function (value, params) {
- var result = parseInt(value);
- if (isNaN(result) || result<-32768 || result>32767) {
+ var result; value = $.trim(value);
+ if (!rf.csv.RE_DIGITS.test(value) || (result=parseInt(value,10))<-32768 || result>32767) {
throw rf.csv.getMessage(params.customMessage, 'SHORT_CONVERTER_SHORT', [value, 0, params.componentId]);
}
return result;
}
-})(window.RichFaces || (window.RichFaces={}))
+})(jQuery, window.RichFaces || (window.RichFaces={}))
});
\ No newline at end of file
Added: branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/convert/BooleanConverterTest.java
===================================================================
--- branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/convert/BooleanConverterTest.java (rev 0)
+++ branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/convert/BooleanConverterTest.java 2010-10-27 17:52:44 UTC (rev 19710)
@@ -0,0 +1,57 @@
+/*
+ * 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.convert;
+
+import javax.faces.convert.BooleanConverter;
+
+import org.junit.Test;
+import org.richfaces.appplication.FacesMessages;
+
+/**
+ * @author Pavel Yaschenko
+ *
+ */
+public class BooleanConverterTest extends BaseConverterTest {
+
+ public BooleanConverterTest() {
+ super("META-INF/resources/org.richfaces/boolean-converter.js");
+ }
+
+ @Test
+ @TestDataHolder(
+ successes = {
+ @TestData(submittedValue = "true"),
+ @TestData(submittedValue = "True"),
+ @TestData(submittedValue = "TRUE"),
+ @TestData(submittedValue = "false"),
+ @TestData(submittedValue = "0"),
+ @TestData(submittedValue = "1"),
+ @TestData(submittedValue = "")
+ },
+ failures = {}
+ )
+ public void testSuccess() throws Exception {
+ setClientConverterClassName("RichFaces.csv.getConverter('boolean')");
+ setConverterId(BooleanConverter.CONVERTER_ID);
+ setConversionErrorMessageEnum(FacesMessages.BOOLEAN_CONVERTER_BOOLEAN);
+ }
+}
Modified: branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/convert/ByteConverterTest.java
===================================================================
--- branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/convert/ByteConverterTest.java 2010-10-27 16:56:42 UTC (rev 19709)
+++ branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/convert/ByteConverterTest.java 2010-10-27 17:52:44 UTC (rev 19710)
@@ -46,7 +46,11 @@
failures = {
@TestData(submittedValue = "-129"),
@TestData(submittedValue = "128"),
- @TestData(submittedValue = "aaa")
+ @TestData(submittedValue = "1.0"),
+ @TestData(submittedValue = "1.2"),
+ @TestData(submittedValue = "1a"),
+ @TestData(submittedValue = "aaa"),
+ @TestData(submittedValue = "- 127")
}
)
public void testSuccess() throws Exception {
Modified: branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/convert/ShortConverterTest.java
===================================================================
--- branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/convert/ShortConverterTest.java 2010-10-27 16:56:42 UTC (rev 19709)
+++ branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/convert/ShortConverterTest.java 2010-10-27 17:52:44 UTC (rev 19710)
@@ -46,11 +46,15 @@
failures = {
@TestData(submittedValue = "-32769"),
@TestData(submittedValue = "32768"),
- @TestData(submittedValue = "aaa")
+ @TestData(submittedValue = "1.0"),
+ @TestData(submittedValue = "1.2"),
+ @TestData(submittedValue = "1a"),
+ @TestData(submittedValue = "aaa"),
+ @TestData(submittedValue = "- 10")
}
)
public void testSuccess() throws Exception {
- setClientConverterClassName("RichFaces.csv.getConverter('byte')");
+ setClientConverterClassName("RichFaces.csv.getConverter('short')");
setConverterId(ShortConverter.CONVERTER_ID);
setConversionErrorMessageEnum(FacesMessages.SHORT_CONVERTER_SHORT);
}
14 years, 3 months
JBoss Rich Faces SVN: r19709 - in branches/RF-7817: push-redesign and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-10-27 12:56:42 -0400 (Wed, 27 Oct 2010)
New Revision: 19709
Added:
branches/RF-7817/push-redesign/richfaces-suppressions.xml
Removed:
branches/RF-7817/push-redesign/checkstyle-suppressions.xml
Modified:
branches/RF-7817/core/impl/src/main/resources/META-INF/resources/richfaces-base-component.js
branches/RF-7817/core/impl/src/main/resources/META-INF/resources/richfaces-event.js
branches/RF-7817/core/impl/src/main/resources/META-INF/resources/richfaces.js
branches/RF-7817/push-redesign-app/src/main/java/demo/ChannelsBean.java
branches/RF-7817/push-redesign-app/src/main/webapp/chat.xhtml
branches/RF-7817/push-redesign/pom.xml
branches/RF-7817/push-redesign/src/main/resources/META-INF/resources/org.richfaces/push.js
Log:
https://jira.jboss.org/browse/RF-7817
Modified: branches/RF-7817/core/impl/src/main/resources/META-INF/resources/richfaces-base-component.js
===================================================================
--- branches/RF-7817/core/impl/src/main/resources/META-INF/resources/richfaces-base-component.js 2010-10-27 16:50:39 UTC (rev 19708)
+++ branches/RF-7817/core/impl/src/main/resources/META-INF/resources/richfaces-base-component.js 2010-10-27 16:56:42 UTC (rev 19709)
@@ -228,8 +228,11 @@
source = source || this.id;
var element = richfaces.getDomElement(source);
if (element) {
- element["richfaces"] = element["richfaces"] || {};
- element.richfaces.component = this;
+ element[richfaces.RICH_CONTAINER] = $.extend(element[richfaces.RICH_CONTAINER] || {},
+ {
+ component:this
+ }
+ );
}
return element;
},
Modified: branches/RF-7817/core/impl/src/main/resources/META-INF/resources/richfaces-event.js
===================================================================
--- branches/RF-7817/core/impl/src/main/resources/META-INF/resources/richfaces-event.js 2010-10-27 16:50:39 UTC (rev 19708)
+++ branches/RF-7817/core/impl/src/main/resources/META-INF/resources/richfaces-event.js 2010-10-27 16:56:42 UTC (rev 19709)
@@ -32,6 +32,9 @@
var getHandlerWrapper = function (component, fn) {
return function (e,d){
+ if (!e[richfaces.RICH_CONTAINER]) {
+ e[richfaces.RICH_CONTAINER] = {data: d};
+ }
return fn.call(component||this, e, this, d);
};
}
@@ -222,7 +225,7 @@
* */
fire : function(selector, eventType, data) {
var event = $.Event(eventType);
- getEventElement(selector).trigger(eventType, data);
+ getEventElement(selector).trigger(event, data);
return !event.isDefaultPrevented();
},
Modified: branches/RF-7817/core/impl/src/main/resources/META-INF/resources/richfaces.js
===================================================================
--- branches/RF-7817/core/impl/src/main/resources/META-INF/resources/richfaces.js 2010-10-27 16:50:39 UTC (rev 19708)
+++ branches/RF-7817/core/impl/src/main/resources/META-INF/resources/richfaces.js 2010-10-27 16:56:42 UTC (rev 19709)
@@ -13,6 +13,8 @@
(function(jQuery, richfaces) {
+ richfaces.RICH_CONTAINER = "rf";
+
// get DOM element by id or DOM element or jQuery object
richfaces.getDomElement = function (source) {
var type = typeof source;
@@ -38,7 +40,7 @@
var element = richfaces.getDomElement(source);
if (element) {
- return (element["richfaces"] || {})["component"];
+ return (element[richfaces.RICH_CONTAINER] || {})["component"];
}
}
Deleted: branches/RF-7817/push-redesign/checkstyle-suppressions.xml
===================================================================
--- branches/RF-7817/push-redesign/checkstyle-suppressions.xml 2010-10-27 16:50:39 UTC (rev 19708)
+++ branches/RF-7817/push-redesign/checkstyle-suppressions.xml 2010-10-27 16:56:42 UTC (rev 19709)
@@ -1,40 +0,0 @@
-<?xml version="1.0"?>
-
-<!DOCTYPE suppressions PUBLIC
- "-//Puppy Crawl//DTD Suppressions 1.0//EN"
- "http://www.puppycrawl.com/dtds/suppressions_1_0.dtd">
-
-<!-- NOTE: Because of issues with maven checkstyle plugin each suppression
- file must have all suppressions defined.
-
- See RF-9077 for details. -->
-<suppressions>
- <suppress checks="DoubleCheckedLocking" files="MultipartRequestRegistry.java" />
- <suppress checks="FallThrough" files="JSMin.java" />
- <suppress checks="IllegalCatch" files="UISwitchablePanel.java" />
- <suppress checks="ModifiedControlVariable" files="MultipartRequest.java" />
- <suppress checks="IllegalCatch" files="StagingServer.java" />
- <suppress checks="IllegalCatch" files="PartialViewContextImpl.java" />
- <suppress checks="FallThrough" files="StagingServer.java" />
- <suppress checks="ModifiedControlVariable" files="Cookie.java" />
- <suppress checks="IllegalCatch" files="CacheManager.java" />
- <suppress checks="MissingSwitchDefault" files="JSONTokener.java" />
- <suppress checks="IllegalCatch" files="AjaxViewRoot.java" />
- <suppress checks="FallThrough" files="XMLTokener.java" />
- <suppress checks="IllegalCatch" files="ResourceHandlerImpl.java" />
- <suppress checks="IllegalThrows" files="AbstractThreadedTest.java" />
- <suppress checks="ModifiedControlVariable" files="URLCodec.java" />
-
- <!-- TODO it is hot fix for building process, this files belong to the test-base module,
- and must be removed from here -->
- <suppress checks="IllegalCatch" files="AbstractThreadedTest.java" />
- <suppress checks="IllegalCatch" files="StagingServer.java" />
-
- <!-- TODO it is hot fix for building process, this files belong to the ui/output/trunk/panela/ui module,
- and must be removed from here -->
- <suppress checks="IllegalCatch" files="AbstractTogglePanel.java" />
-
- <!-- TODO it is hot fix for building process, this files belong to the push-redesign module,
- and must be removed from here -->
- <suppress checks="IllegalCatch" files="AbstractRequest.java" />
-</suppressions>
Modified: branches/RF-7817/push-redesign/pom.xml
===================================================================
--- branches/RF-7817/push-redesign/pom.xml 2010-10-27 16:50:39 UTC (rev 19708)
+++ branches/RF-7817/push-redesign/pom.xml 2010-10-27 16:56:42 UTC (rev 19709)
@@ -24,7 +24,7 @@
<!-- Checkstyle only required here because suppressions needed -->
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
- <suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
+ <suppressionsLocation>${project.basedir}/richfaces-suppressions.xml</suppressionsLocation>
</configuration>
</plugin>
<plugin>
Added: branches/RF-7817/push-redesign/richfaces-suppressions.xml
===================================================================
--- branches/RF-7817/push-redesign/richfaces-suppressions.xml (rev 0)
+++ branches/RF-7817/push-redesign/richfaces-suppressions.xml 2010-10-27 16:56:42 UTC (rev 19709)
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE suppressions PUBLIC
+ "-//Puppy Crawl//DTD Suppressions 1.0//EN"
+ "http://www.puppycrawl.com/dtds/suppressions_1_0.dtd">
+
+<suppressions>
+ <suppress checks="IllegalCatch" files="AbstractRequest.java" />
+</suppressions>
Modified: branches/RF-7817/push-redesign/src/main/resources/META-INF/resources/org.richfaces/push.js
===================================================================
--- branches/RF-7817/push-redesign/src/main/resources/META-INF/resources/org.richfaces/push.js 2010-10-27 16:50:39 UTC (rev 19708)
+++ branches/RF-7817/push-redesign/src/main/resources/META-INF/resources/org.richfaces/push.js 2010-10-27 16:56:42 UTC (rev 19709)
@@ -23,16 +23,20 @@
var COMPONENT_NAME = "Push";
- var DATA_EVENT_NAME = COMPONENT_NAME + richfaces.Event.EVENT_NAMESPACE_SEPARATOR + 'dataAvailable';
+ var RICH_NAMESPACE = richfaces.Event.RICH_NAMESPACE;
+
+ var EVENT_NAMESPACE_SEPARATOR = richfaces.Event.EVENT_NAMESPACE_SEPARATOR;
+
+ var DATA_EVENT_NAME = 'dataAvailable' + EVENT_NAMESPACE_SEPARATOR + RICH_NAMESPACE + EVENT_NAMESPACE_SEPARATOR + COMPONENT_NAME;
- var ERROR_EVENT_NAME = COMPONENT_NAME + richfaces.Event.EVENT_NAMESPACE_SEPARATOR + 'error';
+ var ERROR_EVENT_NAME = 'error' + EVENT_NAMESPACE_SEPARATOR + RICH_NAMESPACE + EVENT_NAMESPACE_SEPARATOR + COMPONENT_NAME;
var getDataEventNamespace = function(address) {
- return richfaces.Event.createNamespace(DATA_EVENT_NAME, address);
+ return DATA_EVENT_NAME + EVENT_NAMESPACE_SEPARATOR + address;
};
var getErrorEventNamespace = function(address) {
- return richfaces.Event.createNamespace(ERROR_EVENT_NAME, address);
+ return ERROR_EVENT_NAME + EVENT_NAMESPACE_SEPARATOR + address;
};
richfaces.Push = (function() {
@@ -196,7 +200,7 @@
__bindDataHandler: function(handlerCode) {
var ns = getDataEventNamespace(this.__address)
- this.__handlers.data = richfaces.Event.bind(document, ns, new Function("event", "object", "data", handlerCode));
+ this.__handlers.data = richfaces.Event.bind(document, ns, new Function("event", handlerCode));
},
__unbindDataHandler: function() {
@@ -210,7 +214,7 @@
__bindErrorHandler: function(handlerCode) {
var ns = getErrorEventNamespace(this.__address);
- this.__handlers.error = richfaces.Event.bind(document, ns, new Function("event", "object", "data", handlerCode));
+ this.__handlers.error = richfaces.Event.bind(document, ns, new Function("event", handlerCode));
},
__unbindErrorHandler: function() {
Modified: branches/RF-7817/push-redesign-app/src/main/java/demo/ChannelsBean.java
===================================================================
--- branches/RF-7817/push-redesign-app/src/main/java/demo/ChannelsBean.java 2010-10-27 16:50:39 UTC (rev 19708)
+++ branches/RF-7817/push-redesign-app/src/main/java/demo/ChannelsBean.java 2010-10-27 16:56:42 UTC (rev 19709)
@@ -21,6 +21,7 @@
*/
package demo;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@@ -33,8 +34,10 @@
*/
@SessionScoped
@ManagedBean
-public class ChannelsBean {
+public class ChannelsBean implements Serializable {
+ private static final long serialVersionUID = 2916670958555985564L;
+
private List<Channel> channels = new ArrayList<Channel>();
public ChannelsBean() {
Modified: branches/RF-7817/push-redesign-app/src/main/webapp/chat.xhtml
===================================================================
--- branches/RF-7817/push-redesign-app/src/main/webapp/chat.xhtml 2010-10-27 16:50:39 UTC (rev 19708)
+++ branches/RF-7817/push-redesign-app/src/main/webapp/chat.xhtml 2010-10-27 16:56:42 UTC (rev 19709)
@@ -53,7 +53,7 @@
</h:selectBooleanCheckbox>
<h:panelGroup layout="block" rendered="#{channel.rendered}">
- <p:push address="#{channelName}@chat" onerror="alert(data)" ondataavailable="jQuery('<div />').prependTo('.#{channelName}Output').text(data)" />
+ <p:push address="#{channelName}@chat" onerror="alert(event.rf.data)" ondataavailable="jQuery('<div />').prependTo('.#{channelName}Output').text(event.rf.data)" />
<h:inputText styleClass="messageInput" value="#{chatBean.message}" size="40" />
14 years, 3 months
JBoss Rich Faces SVN: r19708 - branches/RF-7817.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-10-27 12:50:39 -0400 (Wed, 27 Oct 2010)
New Revision: 19708
Modified:
branches/RF-7817/
Log:
Merged revisions 19156-19157,19159-19160,19176,19186-19187,19190,19194,19196,19199,19203-19204,19231-19234,19248-19249,19255-19256,19258-19262,19276,19279-19281,19283,19285,19291-19299,19307,19312,19315,19318-19319,19325,19341-19342,19345-19351,19353-19355,19358-19359,19364,19367-19369,19371,19374-19377,19379-19385,19387,19393-19394,19400,19402-19404,19418-19422,19426,19430-19431,19434-19441,19443-19444,19446,19468,19470,19477,19491,19498-19499,19501,19504,19506-19507,19517-19519,19525,19542-19543,19548,19550,19555,19557,19560-19561,19565-19566,19571-19573,19582-19585,19592-19593,19599,19601-19602,19613,19646,19657-19659,19665,19671-19674 via svnmerge from
https://svn.jboss.org/repos/richfaces/trunk
Property changes on: branches/RF-7817
___________________________________________________________________
Name: svn:ignore
- target
.settings
.project
.classpath
.clover
.externalToolBuilders
+ target
.settings
.project
.classpath
.clover
.externalToolBuilders
svnmerge-commit-message.txt
Name: svn:externals
- build/parent https://svn.jboss.org/repos/richfaces/modules/build/parent/tags/richfaces...
build/checkstyle https://svn.jboss.org/repos/richfaces/modules/build/resources/tags/richfa...
build/faces-shade-transformers https://svn.jboss.org/repos/richfaces/modules/build/resources/tags/richfa...
+ build/parent http://anonsvn.jboss.org/repos/richfaces/modules/build/parent/tags/richfa...
build/checkstyle http://anonsvn.jboss.org/repos/richfaces/modules/build/resources/tags/ric...
build/faces-shade-transformers https://svn.jboss.org/repos/richfaces/modules/build/resources/tags/richfa...
Name: svnmerge-integrated
- /trunk:1-19153
+ /trunk:1-19678
14 years, 3 months
JBoss Rich Faces SVN: r19707 - in branches/RF-8742/ui/validator/ui/src: test/java/org/richfaces/convert and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2010-10-27 12:48:01 -0400 (Wed, 27 Oct 2010)
New Revision: 19707
Added:
branches/RF-8742/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/short-converter.js
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/convert/ShortConverterTest.java
Modified:
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/convert/ByteConverterTest.java
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/convert/NumberConverterTest.java
Log:
https://jira.jboss.org/browse/RF-9521
short converter was added
unused imports were deleted
Added: branches/RF-8742/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/short-converter.js
===================================================================
--- branches/RF-8742/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/short-converter.js (rev 0)
+++ branches/RF-8742/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/short-converter.js 2010-10-27 16:48:01 UTC (rev 19707)
@@ -0,0 +1,11 @@
+RichFaces.csv.addConverter({"byte":
+(function(rf) {
+ return function (value, params) {
+ var result = parseInt(value);
+ if (isNaN(result) || result<-32768 || result>32767) {
+ throw rf.csv.getMessage(params.customMessage, 'SHORT_CONVERTER_SHORT', [value, 0, params.componentId]);
+ }
+ return result;
+ }
+})(window.RichFaces || (window.RichFaces={}))
+});
\ No newline at end of file
Modified: branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/convert/ByteConverterTest.java
===================================================================
--- branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/convert/ByteConverterTest.java 2010-10-27 16:37:39 UTC (rev 19706)
+++ branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/convert/ByteConverterTest.java 2010-10-27 16:48:01 UTC (rev 19707)
@@ -21,14 +21,9 @@
*/
package org.richfaces.convert;
-import static org.junit.Assert.*;
-
import javax.faces.convert.ByteConverter;
-import javax.faces.convert.NumberConverter;
import org.junit.Test;
-import org.richfaces.application.MessageFactory;
-import org.richfaces.application.ServiceTracker;
import org.richfaces.appplication.FacesMessages;
/**
Modified: branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/convert/NumberConverterTest.java
===================================================================
--- branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/convert/NumberConverterTest.java 2010-10-27 16:37:39 UTC (rev 19706)
+++ branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/convert/NumberConverterTest.java 2010-10-27 16:48:01 UTC (rev 19707)
@@ -21,13 +21,9 @@
*/
package org.richfaces.convert;
-import static org.junit.Assert.*;
-
import javax.faces.convert.NumberConverter;
import org.junit.Test;
-import org.richfaces.application.MessageFactory;
-import org.richfaces.application.ServiceTracker;
import org.richfaces.appplication.FacesMessages;
/**
Added: branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/convert/ShortConverterTest.java
===================================================================
--- branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/convert/ShortConverterTest.java (rev 0)
+++ branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/convert/ShortConverterTest.java 2010-10-27 16:48:01 UTC (rev 19707)
@@ -0,0 +1,57 @@
+/*
+ * 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.convert;
+
+import javax.faces.convert.ShortConverter;
+
+import org.junit.Test;
+import org.richfaces.appplication.FacesMessages;
+
+/**
+ * @author Pavel Yaschenko
+ *
+ */
+public class ShortConverterTest extends BaseConverterTest {
+
+ public ShortConverterTest() {
+ super("META-INF/resources/org.richfaces/short-converter.js");
+ }
+
+ @Test
+ @TestDataHolder(
+ successes = {
+ @TestData(submittedValue = "-32768"),
+ @TestData(submittedValue = "0"),
+ @TestData(submittedValue = "32767")
+ },
+ failures = {
+ @TestData(submittedValue = "-32769"),
+ @TestData(submittedValue = "32768"),
+ @TestData(submittedValue = "aaa")
+ }
+ )
+ public void testSuccess() throws Exception {
+ setClientConverterClassName("RichFaces.csv.getConverter('byte')");
+ setConverterId(ShortConverter.CONVERTER_ID);
+ setConversionErrorMessageEnum(FacesMessages.SHORT_CONVERTER_SHORT);
+ }
+}
14 years, 3 months