JBoss Rich Faces SVN: r19013 - in branches/RFPL-434/core: commons/src/main/java/org/richfaces/application and 6 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-08-30 09:50:49 -0400 (Mon, 30 Aug 2010)
New Revision: 19013
Added:
branches/RFPL-434/core/commons/src/main/java/org/richfaces/application/
branches/RFPL-434/core/commons/src/main/java/org/richfaces/application/CoreMessages.java
branches/RFPL-434/core/commons/src/main/java/org/richfaces/application/FacesMessages.java
branches/RFPL-434/core/impl/src/test/java/org/richfaces/application/
branches/RFPL-434/core/impl/src/test/java/org/richfaces/application/MessageFactoryImpltest.java
branches/RFPL-434/core/impl/src/test/resources/org/richfaces/application/
branches/RFPL-434/core/impl/src/test/resources/org/richfaces/application/MessageFactoryImplTest_ru_RU.properties
Removed:
branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/CoreMessages.java
branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/FacesMessages.java
Modified:
branches/RFPL-434/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderTest.java
Log:
https://jira.jboss.org/browse/RFPL-434
Copied: branches/RFPL-434/core/commons/src/main/java/org/richfaces/application/CoreMessages.java (from rev 19012, branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/CoreMessages.java)
===================================================================
--- branches/RFPL-434/core/commons/src/main/java/org/richfaces/application/CoreMessages.java (rev 0)
+++ branches/RFPL-434/core/commons/src/main/java/org/richfaces/application/CoreMessages.java 2010-08-30 13:50:49 UTC (rev 19013)
@@ -0,0 +1,36 @@
+/*
+ * 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.application;
+
+import org.richfaces.l10n.MessageBundle;
+
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@MessageBundle(baseName = "org.richfaces.Messages")
+public final class CoreMessages {
+
+ private CoreMessages() {}
+
+}
Copied: branches/RFPL-434/core/commons/src/main/java/org/richfaces/application/FacesMessages.java (from rev 19012, branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/FacesMessages.java)
===================================================================
--- branches/RFPL-434/core/commons/src/main/java/org/richfaces/application/FacesMessages.java (rev 0)
+++ branches/RFPL-434/core/commons/src/main/java/org/richfaces/application/FacesMessages.java 2010-08-30 13:50:49 UTC (rev 19013)
@@ -0,0 +1,109 @@
+/*
+ * 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.application;
+
+import javax.faces.application.FacesMessage;
+
+import org.richfaces.l10n.MessageBundle;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@MessageBundle(baseName = FacesMessage.FACES_MESSAGES)
+public enum FacesMessages {
+
+ UIINPUT_CONVERSION("javax.faces.component.UIInput.CONVERSION"),
+ UIINPUT_REQUIRED("javax.faces.component.UIInput.REQUIRED"),
+ UIINPUT_UPDATE("javax.faces.component.UIInput.UPDATE"),
+ UISELECTONE_INVALID("javax.faces.component.UISelectOne.INVALID"),
+ UISELECTMANY_INVALID("javax.faces.component.UISelectMany.INVALID"),
+ BIG_DECIMAL_CONVERTER_DECIMAL("javax.faces.converter.BigDecimalConverter.DECIMAL"),
+ BIG_DECIMAL_CONVERTER_DECIMAL_DETAIL("javax.faces.converter.BigDecimalConverter.DECIMAL_detail"),
+ BIG_INTEGER_CONVERTER_BIGINTEGER("javax.faces.converter.BigIntegerConverter.BIGINTEGER"),
+ BIG_INTEGER_CONVERTER_BIGINTEGER_DETAIL("javax.faces.converter.BigIntegerConverter.BIGINTEGER_detail"),
+ BOOLEAN_CONVERTER_BOOLEAN("javax.faces.converter.BooleanConverter.BOOLEAN"),
+ BOOLEAN_CONVERTER_BOOLEAN_DETAIL("javax.faces.converter.BooleanConverter.BOOLEAN_detail"),
+ BYTE_CONVERTER_BYTE("javax.faces.converter.ByteConverter.BYTE"),
+ BYTE_CONVERTER_BYTE_DETAIL("javax.faces.converter.ByteConverter.BYTE_detail"),
+ CHARACTER_CONVERTER_CHARACTER("javax.faces.converter.CharacterConverter.CHARACTER"),
+ CHARACTER_CONVERTER_CHARACTER_DETAIL("javax.faces.converter.CharacterConverter.CHARACTER_detail"),
+ DATE_TIME_CONVERTER_DATE("javax.faces.converter.DateTimeConverter.DATE"),
+ DATE_TIME_CONVERTER_DATE_DETAIL("javax.faces.converter.DateTimeConverter.DATE_detail"),
+ DATE_TIME_CONVERTER_TIME("javax.faces.converter.DateTimeConverter.TIME"),
+ DATE_TIME_CONVERTER_TIME_DETAIL("javax.faces.converter.DateTimeConverter.TIME_detail"),
+ DATE_TIME_CONVERTER_DATETIME("javax.faces.converter.DateTimeConverter.DATETIME"),
+ DATE_TIME_CONVERTER_DATETIME_DETAIL("javax.faces.converter.DateTimeConverter.DATETIME_detail"),
+ DATE_TIME_CONVERTER_PATTERN_TYPE("javax.faces.converter.DateTimeConverter.PATTERN_TYPE"),
+ DOUBLE_CONVERTER_DOUBLE("javax.faces.converter.DoubleConverter.DOUBLE"),
+ DOUBLE_CONVERTER_DOUBLE_DETAIL("javax.faces.converter.DoubleConverter.DOUBLE_detail"),
+ ENUM_CONVERTER_ENUM("javax.faces.converter.EnumConverter.ENUM"),
+ ENUM_CONVERTER_ENUM_DETAIL("javax.faces.converter.EnumConverter.ENUM_detail"),
+ ENUM_CONVERTER_ENUM_NO_CLASS("javax.faces.converter.EnumConverter.ENUM_NO_CLASS"),
+ ENUM_CONVERTER_ENUM_NO_CLASS_DETAIL("javax.faces.converter.EnumConverter.ENUM_NO_CLASS_detail"),
+ FLOAT_CONVERTER_FLOAT("javax.faces.converter.FloatConverter.FLOAT"),
+ FLOAT_CONVERTER_FLOAT_DETAIL("javax.faces.converter.FloatConverter.FLOAT_detail"),
+ INTEGER_CONVERTER_INTEGER("javax.faces.converter.IntegerConverter.INTEGER"),
+ INTEGER_CONVERTER_INTEGER_DETAIL("javax.faces.converter.IntegerConverter.INTEGER_detail"),
+ LONG_CONVERTER_LONG("javax.faces.converter.LongConverter.LONG"),
+ LONG_CONVERTER_LONG_DETAIL("javax.faces.converter.LongConverter.LONG_detail"),
+ NUMBER_CONVERTER_CURRENCY("javax.faces.converter.NumberConverter.CURRENCY"),
+ NUMBER_CONVERTER_CURRENCY_DETAIL("javax.faces.converter.NumberConverter.CURRENCY_detail"),
+ NUMBER_CONVERTER_PERCENT("javax.faces.converter.NumberConverter.PERCENT"),
+ NUMBER_CONVERTER_PERCENT_DETAIL("javax.faces.converter.NumberConverter.PERCENT_detail"),
+ NUMBER_CONVERTER_NUMBER("javax.faces.converter.NumberConverter.NUMBER"),
+ NUMBER_CONVERTER_NUMBER_DETAIL("javax.faces.converter.NumberConverter.NUMBER_detail"),
+ NUMBER_CONVERTER_PATTERN("javax.faces.converter.NumberConverter.PATTERN"),
+ NUMBER_CONVERTER_PATTERN_DETAIL("javax.faces.converter.NumberConverter.PATTERN_detail"),
+ SHORT_CONVERTER_SHORT("javax.faces.converter.ShortConverter.SHORT"),
+ SHORT_CONVERTER_SHORT_DETAIL("javax.faces.converter.ShortConverter.SHORT_detail"),
+ CONVERTER_STRING("javax.faces.converter.STRING"),
+ DOUBLE_RANGE_VALIDATOR_MAXIMUM("javax.faces.validator.DoubleRangeValidator.MAXIMUM"),
+ DOUBLE_RANGE_VALIDATOR_MINIMUM("javax.faces.validator.DoubleRangeValidator.MINIMUM"),
+ DOUBLE_RANGE_VALIDATOR_NOT_IN_RANGE("javax.faces.validator.DoubleRangeValidator.NOT_IN_RANGE"),
+ DOUBLE_RANGE_VALIDATOR_TYPE("javax.faces.validator.DoubleRangeValidator.TYPE"),
+ LENGTH_VALIDATOR_MAXIMUM("javax.faces.validator.LengthValidator.MAXIMUM"),
+ LENGTH_VALIDATOR_MINIMUM("javax.faces.validator.LengthValidator.MINIMUM"),
+ LONG_RANGE_VALIDATOR_MAXIMUM("javax.faces.validator.LongRangeValidator.MAXIMUM"),
+ LONG_RANGE_VALIDATOR_MINIMUM("javax.faces.validator.LongRangeValidator.MINIMUM"),
+ LONG_RANGE_VALIDATOR_NOT_IN_RANGE("javax.faces.validator.LongRangeValidator.NOT_IN_RANGE"),
+ LONG_RANGE_VALIDATOR_TYPE("javax.faces.validator.LongRangeValidator.TYPE"),
+ VALIDATOR_NOT_IN_RANGE("javax.faces.validator.NOT_IN_RANGE"),
+ REGEX_VALIDATOR_PATTERN_NOT_SET("javax.faces.validator.RegexValidator.PATTERN_NOT_SET"),
+ REGEX_VALIDATOR_PATTERN_NOT_SET_DETAIL("javax.faces.validator.RegexValidator.PATTERN_NOT_SET_detail"),
+ REGEX_VALIDATOR_NOT_MATCHED("javax.faces.validator.RegexValidator.NOT_MATCHED"),
+ REGEX_VALIDATOR_NOT_MATCHED_DETAIL("javax.faces.validator.RegexValidator.NOT_MATCHED_detail"),
+ REGEX_VALIDATOR_MATCH_EXCEPTION("javax.faces.validator.RegexValidator.MATCH_EXCEPTION"),
+ REGEX_VALIDATOR_MATCH_EXCEPTION_DETAIL("javax.faces.validator.RegexValidator.MATCH_EXCEPTION_detail"),
+ BEAN_VALIDATOR_MESSAGE("javax.faces.validator.BeanValidator.MESSAGE");
+
+ private String key;
+
+ private FacesMessages(String key) {
+ this.key = key;
+ }
+
+ @Override
+ public String toString() {
+ return key;
+ }
+}
Deleted: branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/CoreMessages.java
===================================================================
--- branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/CoreMessages.java 2010-08-30 13:04:17 UTC (rev 19012)
+++ branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/CoreMessages.java 2010-08-30 13:50:49 UTC (rev 19013)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces.log;
-
-import org.richfaces.l10n.MessageBundle;
-
-
-/**
- * @author Nick Belaevski
- *
- */
-@MessageBundle(baseName = "org.richfaces.Messages")
-public final class CoreMessages {
-
- private CoreMessages() {}
-
-}
Deleted: branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/FacesMessages.java
===================================================================
--- branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/FacesMessages.java 2010-08-30 13:04:17 UTC (rev 19012)
+++ branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/FacesMessages.java 2010-08-30 13:50:49 UTC (rev 19013)
@@ -1,109 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces.log;
-
-import javax.faces.application.FacesMessage;
-
-import org.richfaces.l10n.MessageBundle;
-
-/**
- * @author Nick Belaevski
- *
- */
-@MessageBundle(baseName = FacesMessage.FACES_MESSAGES)
-public enum FacesMessages {
-
- UIINPUT_CONVERSION("javax.faces.component.UIInput.CONVERSION"),
- UIINPUT_REQUIRED("javax.faces.component.UIInput.REQUIRED"),
- UIINPUT_UPDATE("javax.faces.component.UIInput.UPDATE"),
- UISELECTONE_INVALID("javax.faces.component.UISelectOne.INVALID"),
- UISELECTMANY_INVALID("javax.faces.component.UISelectMany.INVALID"),
- BIG_DECIMAL_CONVERTER_DECIMAL("javax.faces.converter.BigDecimalConverter.DECIMAL"),
- BIG_DECIMAL_CONVERTER_DECIMAL_DETAIL("javax.faces.converter.BigDecimalConverter.DECIMAL_detail"),
- BIG_INTEGER_CONVERTER_BIGINTEGER("javax.faces.converter.BigIntegerConverter.BIGINTEGER"),
- BIG_INTEGER_CONVERTER_BIGINTEGER_DETAIL("javax.faces.converter.BigIntegerConverter.BIGINTEGER_detail"),
- BOOLEAN_CONVERTER_BOOLEAN("javax.faces.converter.BooleanConverter.BOOLEAN"),
- BOOLEAN_CONVERTER_BOOLEAN_DETAIL("javax.faces.converter.BooleanConverter.BOOLEAN_detail"),
- BYTE_CONVERTER_BYTE("javax.faces.converter.ByteConverter.BYTE"),
- BYTE_CONVERTER_BYTE_DETAIL("javax.faces.converter.ByteConverter.BYTE_detail"),
- CHARACTER_CONVERTER_CHARACTER("javax.faces.converter.CharacterConverter.CHARACTER"),
- CHARACTER_CONVERTER_CHARACTER_DETAIL("javax.faces.converter.CharacterConverter.CHARACTER_detail"),
- DATE_TIME_CONVERTER_DATE("javax.faces.converter.DateTimeConverter.DATE"),
- DATE_TIME_CONVERTER_DATE_DETAIL("javax.faces.converter.DateTimeConverter.DATE_detail"),
- DATE_TIME_CONVERTER_TIME("javax.faces.converter.DateTimeConverter.TIME"),
- DATE_TIME_CONVERTER_TIME_DETAIL("javax.faces.converter.DateTimeConverter.TIME_detail"),
- DATE_TIME_CONVERTER_DATETIME("javax.faces.converter.DateTimeConverter.DATETIME"),
- DATE_TIME_CONVERTER_DATETIME_DETAIL("javax.faces.converter.DateTimeConverter.DATETIME_detail"),
- DATE_TIME_CONVERTER_PATTERN_TYPE("javax.faces.converter.DateTimeConverter.PATTERN_TYPE"),
- DOUBLE_CONVERTER_DOUBLE("javax.faces.converter.DoubleConverter.DOUBLE"),
- DOUBLE_CONVERTER_DOUBLE_DETAIL("javax.faces.converter.DoubleConverter.DOUBLE_detail"),
- ENUM_CONVERTER_ENUM("javax.faces.converter.EnumConverter.ENUM"),
- ENUM_CONVERTER_ENUM_DETAIL("javax.faces.converter.EnumConverter.ENUM_detail"),
- ENUM_CONVERTER_ENUM_NO_CLASS("javax.faces.converter.EnumConverter.ENUM_NO_CLASS"),
- ENUM_CONVERTER_ENUM_NO_CLASS_DETAIL("javax.faces.converter.EnumConverter.ENUM_NO_CLASS_detail"),
- FLOAT_CONVERTER_FLOAT("javax.faces.converter.FloatConverter.FLOAT"),
- FLOAT_CONVERTER_FLOAT_DETAIL("javax.faces.converter.FloatConverter.FLOAT_detail"),
- INTEGER_CONVERTER_INTEGER("javax.faces.converter.IntegerConverter.INTEGER"),
- INTEGER_CONVERTER_INTEGER_DETAIL("javax.faces.converter.IntegerConverter.INTEGER_detail"),
- LONG_CONVERTER_LONG("javax.faces.converter.LongConverter.LONG"),
- LONG_CONVERTER_LONG_DETAIL("javax.faces.converter.LongConverter.LONG_detail"),
- NUMBER_CONVERTER_CURRENCY("javax.faces.converter.NumberConverter.CURRENCY"),
- NUMBER_CONVERTER_CURRENCY_DETAIL("javax.faces.converter.NumberConverter.CURRENCY_detail"),
- NUMBER_CONVERTER_PERCENT("javax.faces.converter.NumberConverter.PERCENT"),
- NUMBER_CONVERTER_PERCENT_DETAIL("javax.faces.converter.NumberConverter.PERCENT_detail"),
- NUMBER_CONVERTER_NUMBER("javax.faces.converter.NumberConverter.NUMBER"),
- NUMBER_CONVERTER_NUMBER_DETAIL("javax.faces.converter.NumberConverter.NUMBER_detail"),
- NUMBER_CONVERTER_PATTERN("javax.faces.converter.NumberConverter.PATTERN"),
- NUMBER_CONVERTER_PATTERN_DETAIL("javax.faces.converter.NumberConverter.PATTERN_detail"),
- SHORT_CONVERTER_SHORT("javax.faces.converter.ShortConverter.SHORT"),
- SHORT_CONVERTER_SHORT_DETAIL("javax.faces.converter.ShortConverter.SHORT_detail"),
- CONVERTER_STRING("javax.faces.converter.STRING"),
- DOUBLE_RANGE_VALIDATOR_MAXIMUM("javax.faces.validator.DoubleRangeValidator.MAXIMUM"),
- DOUBLE_RANGE_VALIDATOR_MINIMUM("javax.faces.validator.DoubleRangeValidator.MINIMUM"),
- DOUBLE_RANGE_VALIDATOR_NOT_IN_RANGE("javax.faces.validator.DoubleRangeValidator.NOT_IN_RANGE"),
- DOUBLE_RANGE_VALIDATOR_TYPE("javax.faces.validator.DoubleRangeValidator.TYPE"),
- LENGTH_VALIDATOR_MAXIMUM("javax.faces.validator.LengthValidator.MAXIMUM"),
- LENGTH_VALIDATOR_MINIMUM("javax.faces.validator.LengthValidator.MINIMUM"),
- LONG_RANGE_VALIDATOR_MAXIMUM("javax.faces.validator.LongRangeValidator.MAXIMUM"),
- LONG_RANGE_VALIDATOR_MINIMUM("javax.faces.validator.LongRangeValidator.MINIMUM"),
- LONG_RANGE_VALIDATOR_NOT_IN_RANGE("javax.faces.validator.LongRangeValidator.NOT_IN_RANGE"),
- LONG_RANGE_VALIDATOR_TYPE("javax.faces.validator.LongRangeValidator.TYPE"),
- VALIDATOR_NOT_IN_RANGE("javax.faces.validator.NOT_IN_RANGE"),
- REGEX_VALIDATOR_PATTERN_NOT_SET("javax.faces.validator.RegexValidator.PATTERN_NOT_SET"),
- REGEX_VALIDATOR_PATTERN_NOT_SET_DETAIL("javax.faces.validator.RegexValidator.PATTERN_NOT_SET_detail"),
- REGEX_VALIDATOR_NOT_MATCHED("javax.faces.validator.RegexValidator.NOT_MATCHED"),
- REGEX_VALIDATOR_NOT_MATCHED_DETAIL("javax.faces.validator.RegexValidator.NOT_MATCHED_detail"),
- REGEX_VALIDATOR_MATCH_EXCEPTION("javax.faces.validator.RegexValidator.MATCH_EXCEPTION"),
- REGEX_VALIDATOR_MATCH_EXCEPTION_DETAIL("javax.faces.validator.RegexValidator.MATCH_EXCEPTION_detail"),
- BEAN_VALIDATOR_MESSAGE("javax.faces.validator.BeanValidator.MESSAGE");
-
- private String key;
-
- private FacesMessages(String key) {
- this.key = key;
- }
-
- @Override
- public String toString() {
- return key;
- }
-}
Modified: branches/RFPL-434/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderTest.java
===================================================================
--- branches/RFPL-434/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderTest.java 2010-08-30 13:04:17 UTC (rev 19012)
+++ branches/RFPL-434/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderTest.java 2010-08-30 13:50:49 UTC (rev 19013)
@@ -57,6 +57,7 @@
bundleLoader = null;
facesEnvironment.verify();
+ facesEnvironment.release();
facesEnvironment = null;
}
Added: branches/RFPL-434/core/impl/src/test/java/org/richfaces/application/MessageFactoryImpltest.java
===================================================================
--- branches/RFPL-434/core/impl/src/test/java/org/richfaces/application/MessageFactoryImpltest.java (rev 0)
+++ branches/RFPL-434/core/impl/src/test/java/org/richfaces/application/MessageFactoryImpltest.java 2010-08-30 13:50:49 UTC (rev 19013)
@@ -0,0 +1,129 @@
+/*
+ * 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.application;
+
+import static org.easymock.EasyMock.expect;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.Locale;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIViewRoot;
+
+import org.jboss.test.faces.mock.MockFacesEnvironment;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.richfaces.l10n.BundleLoader;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class MessageFactoryImpltest {
+
+ private MockFacesEnvironment facesEnvironment;
+
+ private MessageFactory messageFactory;
+
+ @Before
+ public void setUp() throws Exception {
+ Locale.setDefault(Locale.US);
+
+ facesEnvironment = MockFacesEnvironment.createEnvironment().withApplication();
+
+ messageFactory = new MessageFactoryImpl(new BundleLoader());
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ facesEnvironment.verify();
+ facesEnvironment.release();
+ facesEnvironment = null;
+
+ messageFactory = null;
+ }
+
+ @Test
+ public void testCreateMessageFromFacesBundle() throws Exception {
+ expect(facesEnvironment.getFacesContext().getViewRoot()).andStubReturn(null);
+ expect(facesEnvironment.getApplication().getMessageBundle()).andStubReturn(null);
+ facesEnvironment.replay();
+
+ // {1}: Could not convert ''{0}'' to a string.
+ FacesMessage stringConverterMessage = messageFactory.createMessage(facesEnvironment.getFacesContext(),
+ FacesMessages.CONVERTER_STRING, "something", "Message");
+
+ assertNotNull(stringConverterMessage);
+ assertEquals(FacesMessage.SEVERITY_INFO, stringConverterMessage.getSeverity());
+ assertEquals("Message: Could not convert 'something' to a string.", stringConverterMessage.getSummary());
+ assertEquals(stringConverterMessage.getSummary(), stringConverterMessage.getDetail());
+
+ // javax.faces.converter.EnumConverter.ENUM={2}: ''{0}'' must be convertible to an enum.
+ // javax.faces.converter.EnumConverter.ENUM_detail={2}: ''{0}'' must be convertible to an enum from the enum that contains the constant ''{1}''.
+ FacesMessage longConverterMessage = messageFactory.createMessage(facesEnvironment.getFacesContext(),
+ FacesMessage.SEVERITY_ERROR, FacesMessages.ENUM_CONVERTER_ENUM, "field", "anotherField", "Failed");
+ assertNotNull(longConverterMessage);
+ assertEquals(FacesMessage.SEVERITY_ERROR, longConverterMessage.getSeverity());
+ assertEquals("Failed: 'field' must be convertible to an enum.", longConverterMessage.getSummary());
+ assertEquals(
+ "Failed: 'field' must be convertible to an enum from the enum that contains the constant 'anotherField'.",
+ longConverterMessage.getDetail());
+ }
+
+ @Test
+ public void testCreateMessageFromApplicationBundle() throws Exception {
+ UIViewRoot mockViewRoot = facesEnvironment.createMock(UIViewRoot.class);
+ expect(mockViewRoot.getLocale()).andStubReturn(new Locale("ru", "RU"));
+ expect(facesEnvironment.getFacesContext().getViewRoot()).andStubReturn(mockViewRoot);
+ expect(facesEnvironment.getApplication().getMessageBundle()).andStubReturn("org.richfaces.application.MessageFactoryImplTest");
+ facesEnvironment.replay();
+
+ // {1}: ''{0}'' ne konvertiruyetsia v stroku.
+ FacesMessage stringConverterMessage = messageFactory.createMessage(facesEnvironment.getFacesContext(),
+ FacesMessages.CONVERTER_STRING, "something", "Message");
+
+ assertNotNull(stringConverterMessage);
+ assertEquals(FacesMessage.SEVERITY_INFO, stringConverterMessage.getSeverity());
+ assertEquals("Message: 'something' ne konvertiruyetsia v stroku.", stringConverterMessage.getSummary());
+ assertEquals(stringConverterMessage.getSummary(), stringConverterMessage.getDetail());
+
+ // javax.faces.converter.EnumConverter.ENUM={2}: ''{0}'' dolzhno konvertirovat''sia v enum.
+ // javax.faces.converter.EnumConverter.ENUM_detail={2}: ''{0}'' dolzhno konvertirovat''sia v enum iz enum s konstantoj ''{1}''.
+ FacesMessage longConverterMessage = messageFactory.createMessage(facesEnvironment.getFacesContext(),
+ FacesMessage.SEVERITY_ERROR, FacesMessages.ENUM_CONVERTER_ENUM, "field", "anotherField", "Failed");
+ assertNotNull(longConverterMessage);
+ assertEquals(FacesMessage.SEVERITY_ERROR, longConverterMessage.getSeverity());
+ assertEquals("Failed: 'field' dolzhno konvertirovat'sia v enum.", longConverterMessage.getSummary());
+ assertEquals(
+ "Failed: 'field' dolzhno konvertirovat'sia v enum iz enum s konstantoj 'anotherField'.",
+ longConverterMessage.getDetail());
+
+ // javax.faces.component.UIInput.CONVERSION={0}: Conversion error occurred.
+ FacesMessage inputConversionMessage = messageFactory.createMessage(facesEnvironment.getFacesContext(),
+ FacesMessages.UIINPUT_CONVERSION, "Failure message");
+ assertNotNull(inputConversionMessage);
+ assertEquals(FacesMessage.SEVERITY_INFO, inputConversionMessage.getSeverity());
+ assertEquals("Failure message: Conversion error occurred.", inputConversionMessage.getSummary());
+ }
+}
Added: branches/RFPL-434/core/impl/src/test/resources/org/richfaces/application/MessageFactoryImplTest_ru_RU.properties
===================================================================
--- branches/RFPL-434/core/impl/src/test/resources/org/richfaces/application/MessageFactoryImplTest_ru_RU.properties (rev 0)
+++ branches/RFPL-434/core/impl/src/test/resources/org/richfaces/application/MessageFactoryImplTest_ru_RU.properties 2010-08-30 13:50:49 UTC (rev 19013)
@@ -0,0 +1,3 @@
+javax.faces.converter.STRING={1}: ''{0}'' ne konvertiruyetsia v stroku.
+javax.faces.converter.EnumConverter.ENUM={2}: ''{0}'' dolzhno konvertirovat''sia v enum.
+javax.faces.converter.EnumConverter.ENUM_detail={2}: ''{0}'' dolzhno konvertirovat''sia v enum iz enum s konstantoj ''{1}''.
\ No newline at end of file
15 years
JBoss Rich Faces SVN: r19012 - in branches/RFPL-434/core: commons/src/main/java/org/richfaces/l10n and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-08-30 09:04:17 -0400 (Mon, 30 Aug 2010)
New Revision: 19012
Added:
branches/RFPL-434/core/api/src/main/java/org/richfaces/application/MessageFactory.java
branches/RFPL-434/core/impl/src/main/java/org/richfaces/application/MessageFactoryImpl.java
Removed:
branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageFactory.java
branches/RFPL-434/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderAppMessages.java
Modified:
branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/BundleLoader.java
branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageBundle.java
branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/CoreMessages.java
branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/FacesMessages.java
branches/RFPL-434/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderTest.java
branches/RFPL-434/core/impl/src/main/java/org/richfaces/application/DefaultModule.java
Log:
https://jira.jboss.org/browse/RFPL-434
Added: branches/RFPL-434/core/api/src/main/java/org/richfaces/application/MessageFactory.java
===================================================================
--- branches/RFPL-434/core/api/src/main/java/org/richfaces/application/MessageFactory.java (rev 0)
+++ branches/RFPL-434/core/api/src/main/java/org/richfaces/application/MessageFactory.java 2010-08-30 13:04:17 UTC (rev 19012)
@@ -0,0 +1,38 @@
+/*
+ * 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.application;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.application.FacesMessage.Severity;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public interface MessageFactory {
+
+ public FacesMessage createMessage(FacesContext facesContext, Enum<?> messageKey, Object... args);
+
+ public FacesMessage createMessage(FacesContext facesContext, Severity severity, Enum<?> messageKey, Object... args);
+
+}
Modified: branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/BundleLoader.java
===================================================================
--- branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/BundleLoader.java 2010-08-30 13:02:12 UTC (rev 19011)
+++ branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/BundleLoader.java 2010-08-30 13:04:17 UTC (rev 19012)
@@ -59,19 +59,12 @@
}
public ResourceBundle getApplicationBundle(FacesContext facesContext, Enum<?> messageKey, Locale locale)
- throws MissingResourceException, IllegalArgumentException {
+ throws MissingResourceException {
- MessageBundle messageBundle = asMessageBundle(messageKey);
-
if (facesContext == null) {
throw new MissingResourceException("FacesContext is null", getClass().getName(), messageKey.toString());
}
- if (!messageBundle.useApplicationBundle()) {
- throw new MissingResourceException("MessageBundle annotation doesn't declare application bundle as used",
- getClass().getName(), messageKey.toString());
- }
-
Application application = facesContext.getApplication();
if (application == null || application.getMessageBundle() == null) {
Modified: branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageBundle.java
===================================================================
--- branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageBundle.java 2010-08-30 13:02:12 UTC (rev 19011)
+++ branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageBundle.java 2010-08-30 13:04:17 UTC (rev 19012)
@@ -36,6 +36,4 @@
public String baseName();
- public boolean useApplicationBundle() default false;
-
}
Deleted: branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageFactory.java
===================================================================
--- branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageFactory.java 2010-08-30 13:02:12 UTC (rev 19011)
+++ branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageFactory.java 2010-08-30 13:04:17 UTC (rev 19012)
@@ -1,138 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces.l10n;
-
-import java.text.MessageFormat;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import javax.faces.application.FacesMessage;
-import javax.faces.application.FacesMessage.Severity;
-import javax.faces.component.UIViewRoot;
-import javax.faces.context.FacesContext;
-
-/**
- * @author Nick Belaevski
- *
- */
-public class MessageFactory {
-
- private BundleLoader bundleLoader;
-
- public MessageFactory(BundleLoader bundleLoader) {
- super();
- this.bundleLoader = bundleLoader;
- }
-
- private Locale detectLocale(FacesContext context) {
- UIViewRoot viewRoot = context.getViewRoot();
- if (viewRoot != null && viewRoot.getLocale() != null) {
- return viewRoot.getLocale();
- }
-
- return null;
- }
-
- public FacesMessage createMessage(FacesContext facesContext, Enum<?> messageKey, Object... args) {
- return createMessage(facesContext, FacesMessage.SEVERITY_INFO, messageKey, args);
- }
-
- public FacesMessage createMessage(FacesContext facesContext, Severity severity, Enum<?> messageKey, Object... args) {
- if (facesContext == null) {
- throw new NullPointerException("context");
- }
-
- if (severity == null) {
- throw new NullPointerException("severity");
- }
-
- if (messageKey == null) {
- throw new NullPointerException("messageKey");
- }
-
- FacesMessage result = null;
-
- Locale locale = detectLocale(facesContext);
- if (locale != null) {
- result = createMessage(facesContext, severity, locale, messageKey, args);
- }
-
- if (result == null) {
- Locale defaultLocale = Locale.getDefault();
-
- if (!defaultLocale.equals(locale)) {
- result = createMessage(facesContext, severity, defaultLocale, messageKey, args);
- }
-
- }
-
- return result;
- }
-
- protected FacesMessage createMessage(FacesContext context, Severity severity, Locale locale, Enum<?> messageKey,
- Object... args) {
-
- MessageBundle messageBundle = messageKey.getClass().getAnnotation(MessageBundle.class);
-
- if (messageBundle == null) {
- return null;
- }
-
- String messageId = messageKey.toString();
-
- String summary = null;
- String detail = null;
-
- try {
- ResourceBundle bundle = bundleLoader.getApplicationBundle(context, messageKey, locale);
- summary = bundle.getString(messageId);
- detail = bundle.getString(messageId + "_detail");
- } catch (MissingResourceException e) {
- // do nothing
- }
-
- if (summary == null) {
- try {
- ResourceBundle bundle = bundleLoader.getBundle(messageKey, locale);
- summary = bundle.getString(messageId);
- detail = bundle.getString(messageId + "_detail");
- } catch (MissingResourceException e) {
- // do nothing
- }
- }
-
- if (summary == null) {
- return null;
- }
-
- String formattedSummary = MessageFormat.format(summary, args);
- String formattedDetail = null;
-
- if (detail != null) {
- formattedDetail = MessageFormat.format(detail, args);
- }
-
- return new FacesMessage(severity, formattedSummary, formattedDetail);
- }
-
-}
Modified: branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/CoreMessages.java
===================================================================
--- branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/CoreMessages.java 2010-08-30 13:02:12 UTC (rev 19011)
+++ branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/CoreMessages.java 2010-08-30 13:04:17 UTC (rev 19012)
@@ -28,7 +28,7 @@
* @author Nick Belaevski
*
*/
-@MessageBundle(baseName = "org.richfaces.Messages", useApplicationBundle = true)
+@MessageBundle(baseName = "org.richfaces.Messages")
public final class CoreMessages {
private CoreMessages() {}
Modified: branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/FacesMessages.java
===================================================================
--- branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/FacesMessages.java 2010-08-30 13:02:12 UTC (rev 19011)
+++ branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/FacesMessages.java 2010-08-30 13:04:17 UTC (rev 19012)
@@ -29,7 +29,7 @@
* @author Nick Belaevski
*
*/
-@MessageBundle(baseName = FacesMessage.FACES_MESSAGES, useApplicationBundle = true)
+@MessageBundle(baseName = FacesMessage.FACES_MESSAGES)
public enum FacesMessages {
UIINPUT_CONVERSION("javax.faces.component.UIInput.CONVERSION"),
Deleted: branches/RFPL-434/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderAppMessages.java
===================================================================
--- branches/RFPL-434/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderAppMessages.java 2010-08-30 13:02:12 UTC (rev 19011)
+++ branches/RFPL-434/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderAppMessages.java 2010-08-30 13:04:17 UTC (rev 19012)
@@ -1,33 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces.l10n;
-
-/**
- * @author Nick Belaevski
- *
- */
-@MessageBundle(baseName = "org.richfaces.l10n.BundleLoaderMessages", useApplicationBundle = true)
-public enum BundleLoaderAppMessages {
-
- message
-
-}
Modified: branches/RFPL-434/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderTest.java
===================================================================
--- branches/RFPL-434/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderTest.java 2010-08-30 13:02:12 UTC (rev 19011)
+++ branches/RFPL-434/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderTest.java 2010-08-30 13:04:17 UTC (rev 19012)
@@ -86,15 +86,15 @@
assertEquals(
"Welcome to app",
- bundleLoader.getApplicationBundle(facesEnvironment.getFacesContext(), BundleLoaderAppMessages.message,
+ bundleLoader.getApplicationBundle(facesEnvironment.getFacesContext(), BundleLoaderCoreMessages.message,
Locale.US).getString("message"));
assertEquals(
"Dobro pozhalovat'",
- bundleLoader.getApplicationBundle(facesEnvironment.getFacesContext(), BundleLoaderAppMessages.message,
+ bundleLoader.getApplicationBundle(facesEnvironment.getFacesContext(), BundleLoaderCoreMessages.message,
new Locale("by", "BY")).getString("message"));
try {
- bundleLoader.getApplicationBundle(facesEnvironment.getFacesContext(), BundleLoaderAppMessages.message,
+ bundleLoader.getApplicationBundle(facesEnvironment.getFacesContext(), BundleLoaderCoreMessages.message,
new Locale("ru", "RU"));
fail();
} catch (MissingResourceException e) {
Modified: branches/RFPL-434/core/impl/src/main/java/org/richfaces/application/DefaultModule.java
===================================================================
--- branches/RFPL-434/core/impl/src/main/java/org/richfaces/application/DefaultModule.java 2010-08-30 13:02:12 UTC (rev 19011)
+++ branches/RFPL-434/core/impl/src/main/java/org/richfaces/application/DefaultModule.java 2010-08-30 13:04:17 UTC (rev 19012)
@@ -3,6 +3,7 @@
import org.ajax4jsf.cache.Cache;
import org.ajax4jsf.context.InitParametersStorage;
import org.ajax4jsf.renderkit.AJAXDataSerializer;
+import org.richfaces.l10n.BundleLoader;
import org.richfaces.resource.DefaultResourceCodec;
import org.richfaces.resource.ResourceCodec;
import org.richfaces.skin.SkinFactory;
@@ -18,6 +19,7 @@
factory.setInstance(Uptime.class, new Uptime());
factory.setInstance(DependencyInjector.class, new DependencyInjectionServiceImpl());
factory.setInstance(InitParametersStorage.class, new InitParametersStorage());
+ factory.setInstance(MessageFactory.class, new MessageFactoryImpl(new BundleLoader()));
}
}
Copied: branches/RFPL-434/core/impl/src/main/java/org/richfaces/application/MessageFactoryImpl.java (from rev 19010, branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageFactory.java)
===================================================================
--- branches/RFPL-434/core/impl/src/main/java/org/richfaces/application/MessageFactoryImpl.java (rev 0)
+++ branches/RFPL-434/core/impl/src/main/java/org/richfaces/application/MessageFactoryImpl.java 2010-08-30 13:04:17 UTC (rev 19012)
@@ -0,0 +1,141 @@
+/*
+ * 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.application;
+
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.application.FacesMessage.Severity;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.l10n.BundleLoader;
+import org.richfaces.l10n.MessageBundle;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class MessageFactoryImpl implements MessageFactory {
+
+ private BundleLoader bundleLoader;
+
+ public MessageFactoryImpl(BundleLoader bundleLoader) {
+ super();
+ this.bundleLoader = bundleLoader;
+ }
+
+ private Locale detectLocale(FacesContext context) {
+ UIViewRoot viewRoot = context.getViewRoot();
+ if (viewRoot != null && viewRoot.getLocale() != null) {
+ return viewRoot.getLocale();
+ }
+
+ return null;
+ }
+
+ public FacesMessage createMessage(FacesContext facesContext, Enum<?> messageKey, Object... args) {
+ return createMessage(facesContext, FacesMessage.SEVERITY_INFO, messageKey, args);
+ }
+
+ public FacesMessage createMessage(FacesContext facesContext, Severity severity, Enum<?> messageKey, Object... args) {
+ if (facesContext == null) {
+ throw new NullPointerException("context");
+ }
+
+ if (severity == null) {
+ throw new NullPointerException("severity");
+ }
+
+ if (messageKey == null) {
+ throw new NullPointerException("messageKey");
+ }
+
+ FacesMessage result = null;
+
+ Locale locale = detectLocale(facesContext);
+ if (locale != null) {
+ result = createMessage(facesContext, severity, locale, messageKey, args);
+ }
+
+ if (result == null) {
+ Locale defaultLocale = Locale.getDefault();
+
+ if (!defaultLocale.equals(locale)) {
+ result = createMessage(facesContext, severity, defaultLocale, messageKey, args);
+ }
+
+ }
+
+ return result;
+ }
+
+ protected FacesMessage createMessage(FacesContext context, Severity severity, Locale locale, Enum<?> messageKey,
+ Object... args) {
+
+ MessageBundle messageBundle = messageKey.getClass().getAnnotation(MessageBundle.class);
+
+ if (messageBundle == null) {
+ return null;
+ }
+
+ String messageId = messageKey.toString();
+
+ String summary = null;
+ String detail = null;
+
+ try {
+ ResourceBundle bundle = bundleLoader.getApplicationBundle(context, messageKey, locale);
+ summary = bundle.getString(messageId);
+ detail = bundle.getString(messageId + "_detail");
+ } catch (MissingResourceException e) {
+ // do nothing
+ }
+
+ if (summary == null) {
+ try {
+ ResourceBundle bundle = bundleLoader.getBundle(messageKey, locale);
+ summary = bundle.getString(messageId);
+ detail = bundle.getString(messageId + "_detail");
+ } catch (MissingResourceException e) {
+ // do nothing
+ }
+ }
+
+ if (summary == null) {
+ return null;
+ }
+
+ String formattedSummary = MessageFormat.format(summary, args);
+ String formattedDetail = null;
+
+ if (detail != null) {
+ formattedDetail = MessageFormat.format(detail, args);
+ }
+
+ return new FacesMessage(severity, formattedSummary, formattedDetail);
+ }
+
+}
15 years
JBoss Rich Faces SVN: r19011 - modules/tests/metamer/trunk/application/src/main/webapp/components/richPopupPanel.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-08-30 09:02:12 -0400 (Mon, 30 Aug 2010)
New Revision: 19011
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richPopupPanel/outsideForm.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richPopupPanel/simple.xhtml
Log:
* fixed typos in attribute names
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richPopupPanel/outsideForm.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richPopupPanel/outsideForm.xhtml 2010-08-30 12:32:48 UTC (rev 19010)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richPopupPanel/outsideForm.xhtml 2010-08-30 13:02:12 UTC (rev 19011)
@@ -57,9 +57,9 @@
keepVisualState="#{richPopupPanelBean.attributes['keepVisualState'].value}"
left="#{richPopupPanelBean.attributes['left'].value}"
maxHeight="#{richPopupPanelBean.attributes['maxHeight'].value}"
- maxWidth="#{richPopupPanelBean.attributes['maxWidht'].value}"
+ maxWidth="#{richPopupPanelBean.attributes['maxWidth'].value}"
minHeight="#{richPopupPanelBean.attributes['minHeight'].value}"
- minWidht="#{richPopupPanelBean.attributes['minWidht'].value}"
+ minWidth="#{richPopupPanelBean.attributes['minWidth'].value}"
modal="#{richPopupPanelBean.attributes['modal'].value}"
moveable="#{richPopupPanelBean.attributes['moveable'].value}"
onbeforehide = "#{richPopupPanelBean.attributes['onbeforehide'].value}"
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richPopupPanel/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richPopupPanel/simple.xhtml 2010-08-30 12:32:48 UTC (rev 19010)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richPopupPanel/simple.xhtml 2010-08-30 13:02:12 UTC (rev 19011)
@@ -55,9 +55,9 @@
keepVisualState="#{richPopupPanelBean.attributes['keepVisualState'].value}"
left="#{richPopupPanelBean.attributes['left'].value}"
maxHeight="#{richPopupPanelBean.attributes['maxHeight'].value}"
- maxWidth="#{richPopupPanelBean.attributes['maxWidht'].value}"
+ maxWidth="#{richPopupPanelBean.attributes['maxWidth'].value}"
minHeight="#{richPopupPanelBean.attributes['minHeight'].value}"
- minWidht="#{richPopupPanelBean.attributes['minWidht'].value}"
+ minWidth="#{richPopupPanelBean.attributes['minWidth'].value}"
modal="#{richPopupPanelBean.attributes['modal'].value}"
moveable="#{richPopupPanelBean.attributes['moveable'].value}"
onbeforehide="#{richPopupPanelBean.attributes['onbeforehide'].value}"
15 years
JBoss Rich Faces SVN: r19010 - in branches/RFPL-434/core/commons/src: test and 6 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-08-30 08:32:48 -0400 (Mon, 30 Aug 2010)
New Revision: 19010
Added:
branches/RFPL-434/core/commons/src/test/java/org/richfaces/l10n/
branches/RFPL-434/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderAppMessages.java
branches/RFPL-434/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderCoreMessages.java
branches/RFPL-434/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderTest.java
branches/RFPL-434/core/commons/src/test/resources/
branches/RFPL-434/core/commons/src/test/resources/org/
branches/RFPL-434/core/commons/src/test/resources/org/richfaces/
branches/RFPL-434/core/commons/src/test/resources/org/richfaces/l10n/
branches/RFPL-434/core/commons/src/test/resources/org/richfaces/l10n/AppMessages_by_BY.properties
branches/RFPL-434/core/commons/src/test/resources/org/richfaces/l10n/AppMessages_en_US.properties
branches/RFPL-434/core/commons/src/test/resources/org/richfaces/l10n/BundleLoaderMessages_en_US.properties
branches/RFPL-434/core/commons/src/test/resources/org/richfaces/l10n/BundleLoaderMessages_ru_RU.properties
Modified:
branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/BundleLoader.java
branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageBundle.java
branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageFactory.java
branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageInterpolator.java
Log:
RFPL-434
Modified: branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/BundleLoader.java
===================================================================
--- branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/BundleLoader.java 2010-08-30 07:58:57 UTC (rev 19009)
+++ branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/BundleLoader.java 2010-08-30 12:32:48 UTC (rev 19010)
@@ -25,91 +25,16 @@
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
import javax.faces.application.Application;
-import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
-import com.google.common.base.Function;
-import com.google.common.collect.MapMaker;
-
/**
* @author Nick Belaevski
*
*/
public class BundleLoader {
- private static final class BundleKey {
-
- private Locale locale;
-
- private String baseName;
-
- public BundleKey(String baseName, Locale locale) {
- super();
- this.baseName = baseName;
- this.locale = locale;
- }
-
- public String getBaseName() {
- return baseName;
- }
-
- public Locale getLocale() {
- return locale;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((baseName == null) ? 0 : baseName.hashCode());
- result = prime * result + ((locale == null) ? 0 : locale.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- BundleKey other = (BundleKey) obj;
- if (baseName == null) {
- if (other.baseName != null) {
- return false;
- }
- } else if (!baseName.equals(other.baseName)) {
- return false;
- }
- if (locale == null) {
- if (other.locale != null) {
- return false;
- }
- } else if (!locale.equals(other.locale)) {
- return false;
- }
- return true;
- }
-
- }
-
- private static ConcurrentMap<ClassLoader, ConcurrentMap<BundleKey, ResourceBundle>> bundlesCache = new MapMaker()
- .weakKeys().makeComputingMap(new Function<ClassLoader, ConcurrentMap<BundleKey, ResourceBundle>>() {
-
- public ConcurrentMap<BundleKey, ResourceBundle> apply(ClassLoader from) {
- return new ConcurrentHashMap<BundleKey, ResourceBundle>();
- };
-
- });
-
private ClassLoader getClassLoader() {
return Thread.currentThread().getContextClassLoader();
}
@@ -126,39 +51,14 @@
return bundleAnnotation;
}
- private Locale detectLocale(FacesContext context) {
- UIViewRoot viewRoot = context.getViewRoot();
- if (viewRoot != null && viewRoot.getLocale() != null) {
- return viewRoot.getLocale();
- }
-
- return null;
- }
-
- protected ResourceBundle getOrCreateResourceBundle(BundleKey bundleKey) throws MissingResourceException {
- ClassLoader loader = getClassLoader();
- ConcurrentMap<BundleKey, ResourceBundle> bundles = bundlesCache.get(loader);
- ResourceBundle bundle = bundles.get(bundleKey);
-
- if (bundle == null) {
- bundle = ResourceBundle.getBundle(bundleKey.getBaseName(), bundleKey.getLocale(), loader);
- bundles.put(bundleKey, bundle);
- }
-
- return bundle;
- }
-
public ResourceBundle getBundle(Enum<?> messageKey, Locale locale) throws MissingResourceException,
IllegalArgumentException {
MessageBundle bundleAnnotation = asMessageBundle(messageKey);
- BundleKey bundleKey = new BundleKey(bundleAnnotation.baseName(), locale);
-
- ResourceBundle bundle = getOrCreateResourceBundle(bundleKey);
-
- return bundle;
+
+ return ResourceBundle.getBundle(bundleAnnotation.baseName(), locale, getClassLoader());
}
- public ResourceBundle getApplicationBundle(FacesContext facesContext, Enum<?> messageKey, boolean useDefaultLocale)
+ public ResourceBundle getApplicationBundle(FacesContext facesContext, Enum<?> messageKey, Locale locale)
throws MissingResourceException, IllegalArgumentException {
MessageBundle messageBundle = asMessageBundle(messageKey);
@@ -179,19 +79,6 @@
getClass().getName(), messageKey.toString());
}
- Locale locale;
- if (!useDefaultLocale) {
- locale = detectLocale(facesContext);
- } else {
- locale = Locale.getDefault();
- }
-
- if (locale == null) {
- throw new MissingResourceException("Cannot read locale from application",
- getClass().getName(), messageKey.toString());
- }
-
- BundleKey bundleKey = new BundleKey(application.getMessageBundle(), locale);
- return getOrCreateResourceBundle(bundleKey);
+ return ResourceBundle.getBundle(application.getMessageBundle(), locale, getClassLoader());
}
}
Modified: branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageBundle.java
===================================================================
--- branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageBundle.java 2010-08-30 07:58:57 UTC (rev 19009)
+++ branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageBundle.java 2010-08-30 12:32:48 UTC (rev 19010)
@@ -36,6 +36,6 @@
public String baseName();
- public boolean useApplicationBundle();
+ public boolean useApplicationBundle() default false;
}
Modified: branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageFactory.java
===================================================================
--- branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageFactory.java 2010-08-30 07:58:57 UTC (rev 19009)
+++ branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageFactory.java 2010-08-30 12:32:48 UTC (rev 19010)
@@ -37,47 +37,6 @@
*/
public class MessageFactory {
- private enum BundleLoaderInvoker {
- application {
- @Override
- public ResourceBundle getBundle(BundleLoader bundleLoader, FacesContext context, Enum<?> messageKey,
- Locale locale) throws MissingResourceException {
-
- return bundleLoader.getApplicationBundle(context, messageKey, false);
- }
- },
-
- annotation {
- @Override
- public ResourceBundle getBundle(BundleLoader bundleLoader, FacesContext context, Enum<?> messageKey,
- Locale locale) throws MissingResourceException {
-
- return bundleLoader.getBundle(messageKey, locale);
- }
- },
-
- applicationDefaultLocale {
- @Override
- public ResourceBundle getBundle(BundleLoader bundleLoader, FacesContext context, Enum<?> messageKey,
- Locale locale) throws MissingResourceException {
-
- return bundleLoader.getApplicationBundle(context, messageKey, true);
- }
- },
-
- anotationDefaultLocale {
- @Override
- public ResourceBundle getBundle(BundleLoader bundleLoader, FacesContext context, Enum<?> messageKey,
- Locale locale) throws MissingResourceException {
-
- return bundleLoader.getBundle(messageKey, Locale.getDefault());
- }
- };
-
- public abstract ResourceBundle getBundle(BundleLoader bundleLoader, FacesContext context, Enum<?> messageKey,
- Locale locale) throws MissingResourceException;
- }
-
private BundleLoader bundleLoader;
public MessageFactory(BundleLoader bundleLoader) {
@@ -85,29 +44,46 @@
this.bundleLoader = bundleLoader;
}
+ private Locale detectLocale(FacesContext context) {
+ UIViewRoot viewRoot = context.getViewRoot();
+ if (viewRoot != null && viewRoot.getLocale() != null) {
+ return viewRoot.getLocale();
+ }
+
+ return null;
+ }
+
public FacesMessage createMessage(FacesContext facesContext, Enum<?> messageKey, Object... args) {
return createMessage(facesContext, FacesMessage.SEVERITY_INFO, messageKey, args);
}
public FacesMessage createMessage(FacesContext facesContext, Severity severity, Enum<?> messageKey, Object... args) {
- Locale locale;
+ if (facesContext == null) {
+ throw new NullPointerException("context");
+ }
+
+ if (severity == null) {
+ throw new NullPointerException("severity");
+ }
+
+ if (messageKey == null) {
+ throw new NullPointerException("messageKey");
+ }
+
FacesMessage result = null;
- if (facesContext != null) {
- UIViewRoot viewRoot = facesContext.getViewRoot();
-
- if (viewRoot != null) {
- locale = viewRoot.getLocale();
-
- if (locale != null) {
- result = createMessage(facesContext, severity, locale, messageKey, args);
- }
- }
+ Locale locale = detectLocale(facesContext);
+ if (locale != null) {
+ result = createMessage(facesContext, severity, locale, messageKey, args);
}
if (result == null) {
- locale = Locale.getDefault();
- result = createMessage(facesContext, severity, locale, messageKey, args);
+ Locale defaultLocale = Locale.getDefault();
+
+ if (!defaultLocale.equals(locale)) {
+ result = createMessage(facesContext, severity, defaultLocale, messageKey, args);
+ }
+
}
return result;
@@ -127,20 +103,28 @@
String summary = null;
String detail = null;
- for (BundleLoaderInvoker invoker : BundleLoaderInvoker.values()) {
+ try {
+ ResourceBundle bundle = bundleLoader.getApplicationBundle(context, messageKey, locale);
+ summary = bundle.getString(messageId);
+ detail = bundle.getString(messageId + "_detail");
+ } catch (MissingResourceException e) {
+ // do nothing
+ }
+
+ if (summary == null) {
try {
- ResourceBundle bundle = invoker.getBundle(bundleLoader, context, messageKey, locale);
+ ResourceBundle bundle = bundleLoader.getBundle(messageKey, locale);
summary = bundle.getString(messageId);
detail = bundle.getString(messageId + "_detail");
} catch (MissingResourceException e) {
// do nothing
}
-
- if (summary != null) {
- break;
- }
}
+ if (summary == null) {
+ return null;
+ }
+
String formattedSummary = MessageFormat.format(summary, args);
String formattedDetail = null;
Modified: branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageInterpolator.java
===================================================================
--- branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageInterpolator.java 2010-08-30 07:58:57 UTC (rev 19009)
+++ branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageInterpolator.java 2010-08-30 12:32:48 UTC (rev 19010)
@@ -52,35 +52,46 @@
return key.toString();
}
- protected String getPattern(Locale locale, Enum<?> key) throws MissingResourceException {
+ protected String getPattern(Locale locale, Enum<?> key) {
String messageKey = getMessageKey(key);
- try {
- ResourceBundle bundle = bundleLoader.getBundle(key, locale);
- String messagePattern = bundle.getString(messageKey);
+
+ if (checkApplicationBundle) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
- return messagePattern;
- } catch (MissingResourceException e) {
- if (checkApplicationBundle) {
- FacesContext facesContext = FacesContext.getCurrentInstance();
+ if (facesContext != null) {
try {
- ResourceBundle bundle = bundleLoader.getApplicationBundle(facesContext, key, false);
+ ResourceBundle bundle = bundleLoader.getApplicationBundle(facesContext, key, locale);
return bundle.getString(messageKey);
} catch (MissingResourceException e1) {
- ResourceBundle bundle = bundleLoader.getApplicationBundle(facesContext, key, true);
- return bundle.getString(messageKey);
+ //do nothing
}
- } else {
- throw e;
}
}
+
+ try {
+ ResourceBundle bundle = bundleLoader.getBundle(key, locale);
+ return bundle.getString(messageKey);
+ } catch (MissingResourceException e) {
+ //do nothing
+ }
+
+ return null;
}
public String interpolate(Locale locale, Enum<?> key, Object... args) throws InterpolationException {
- try {
- String messagePattern = getPattern(locale, key);
+ String messagePattern = getPattern(locale, key);
+
+ if (messagePattern == null) {
+ Locale defaultLocale = Locale.getDefault();
+ if (!defaultLocale.equals(locale)) {
+ messagePattern = getPattern(defaultLocale, key);
+ }
+ }
+
+ if (messagePattern != null) {
return MessageFormat.format(messagePattern, args);
- } catch (MissingResourceException e) {
- throw new InterpolationException(e).initMessageKey(key.toString());
+ } else {
+ throw new InterpolationException().initMessageKey(key.toString());
}
}
Added: branches/RFPL-434/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderAppMessages.java
===================================================================
--- branches/RFPL-434/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderAppMessages.java (rev 0)
+++ branches/RFPL-434/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderAppMessages.java 2010-08-30 12:32:48 UTC (rev 19010)
@@ -0,0 +1,33 @@
+/*
+ * 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.l10n;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@MessageBundle(baseName = "org.richfaces.l10n.BundleLoaderMessages", useApplicationBundle = true)
+public enum BundleLoaderAppMessages {
+
+ message
+
+}
Added: branches/RFPL-434/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderCoreMessages.java
===================================================================
--- branches/RFPL-434/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderCoreMessages.java (rev 0)
+++ branches/RFPL-434/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderCoreMessages.java 2010-08-30 12:32:48 UTC (rev 19010)
@@ -0,0 +1,33 @@
+/*
+ * 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.l10n;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@MessageBundle(baseName = "org.richfaces.l10n.BundleLoaderMessages")
+public enum BundleLoaderCoreMessages {
+
+ message
+
+}
Added: branches/RFPL-434/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderTest.java
===================================================================
--- branches/RFPL-434/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderTest.java (rev 0)
+++ branches/RFPL-434/core/commons/src/test/java/org/richfaces/l10n/BundleLoaderTest.java 2010-08-30 12:32:48 UTC (rev 19010)
@@ -0,0 +1,104 @@
+/*
+ * 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.l10n;
+
+import static org.easymock.EasyMock.expect;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import java.util.Locale;
+import java.util.MissingResourceException;
+
+import org.jboss.test.faces.mock.MockFacesEnvironment;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class BundleLoaderTest {
+
+ private MockFacesEnvironment facesEnvironment;
+
+ private BundleLoader bundleLoader;
+
+ @Before
+ public void setUp() throws Exception {
+ Locale.setDefault(Locale.ENGLISH);
+
+ bundleLoader = new BundleLoader();
+
+ facesEnvironment = MockFacesEnvironment.createEnvironment().withApplication();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ bundleLoader = null;
+
+ facesEnvironment.verify();
+
+ facesEnvironment = null;
+ }
+
+ @Test
+ public void testGetMessageBundle() throws Exception {
+ facesEnvironment.replay();
+
+ assertEquals("Hello", bundleLoader.getBundle(BundleLoaderCoreMessages.message, Locale.US).getString("message"));
+ assertEquals("Zdravstvujte", bundleLoader.getBundle(BundleLoaderCoreMessages.message, new Locale("ru", "RU"))
+ .getString("message"));
+
+ try {
+ bundleLoader.getBundle(BundleLoaderCoreMessages.message, new Locale("by", "BY"));
+ fail();
+ } catch (MissingResourceException e) {
+ // ok
+ }
+
+ }
+
+ @Test
+ public void testGetApplicationBundle() throws Exception {
+ expect(facesEnvironment.getApplication().getMessageBundle()).andStubReturn("org.richfaces.l10n.AppMessages");
+
+ facesEnvironment.replay();
+
+ assertEquals(
+ "Welcome to app",
+ bundleLoader.getApplicationBundle(facesEnvironment.getFacesContext(), BundleLoaderAppMessages.message,
+ Locale.US).getString("message"));
+ assertEquals(
+ "Dobro pozhalovat'",
+ bundleLoader.getApplicationBundle(facesEnvironment.getFacesContext(), BundleLoaderAppMessages.message,
+ new Locale("by", "BY")).getString("message"));
+
+ try {
+ bundleLoader.getApplicationBundle(facesEnvironment.getFacesContext(), BundleLoaderAppMessages.message,
+ new Locale("ru", "RU"));
+ fail();
+ } catch (MissingResourceException e) {
+ // ok
+ }
+ }
+}
Added: branches/RFPL-434/core/commons/src/test/resources/org/richfaces/l10n/AppMessages_by_BY.properties
===================================================================
--- branches/RFPL-434/core/commons/src/test/resources/org/richfaces/l10n/AppMessages_by_BY.properties (rev 0)
+++ branches/RFPL-434/core/commons/src/test/resources/org/richfaces/l10n/AppMessages_by_BY.properties 2010-08-30 12:32:48 UTC (rev 19010)
@@ -0,0 +1 @@
+message=Dobro pozhalovat'
\ No newline at end of file
Added: branches/RFPL-434/core/commons/src/test/resources/org/richfaces/l10n/AppMessages_en_US.properties
===================================================================
--- branches/RFPL-434/core/commons/src/test/resources/org/richfaces/l10n/AppMessages_en_US.properties (rev 0)
+++ branches/RFPL-434/core/commons/src/test/resources/org/richfaces/l10n/AppMessages_en_US.properties 2010-08-30 12:32:48 UTC (rev 19010)
@@ -0,0 +1 @@
+message=Welcome to app
\ No newline at end of file
Added: branches/RFPL-434/core/commons/src/test/resources/org/richfaces/l10n/BundleLoaderMessages_en_US.properties
===================================================================
--- branches/RFPL-434/core/commons/src/test/resources/org/richfaces/l10n/BundleLoaderMessages_en_US.properties (rev 0)
+++ branches/RFPL-434/core/commons/src/test/resources/org/richfaces/l10n/BundleLoaderMessages_en_US.properties 2010-08-30 12:32:48 UTC (rev 19010)
@@ -0,0 +1 @@
+message=Hello
\ No newline at end of file
Added: branches/RFPL-434/core/commons/src/test/resources/org/richfaces/l10n/BundleLoaderMessages_ru_RU.properties
===================================================================
--- branches/RFPL-434/core/commons/src/test/resources/org/richfaces/l10n/BundleLoaderMessages_ru_RU.properties (rev 0)
+++ branches/RFPL-434/core/commons/src/test/resources/org/richfaces/l10n/BundleLoaderMessages_ru_RU.properties 2010-08-30 12:32:48 UTC (rev 19010)
@@ -0,0 +1 @@
+message=Zdravstvujte
\ No newline at end of file
15 years
JBoss Rich Faces SVN: r19009 - in trunk: ui/input/ui/src/main/resources/META-INF/resources/org.richfaces and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2010-08-30 03:58:57 -0400 (Mon, 30 Aug 2010)
New Revision: 19009
Modified:
trunk/examples/input-demo/src/main/webapp/autocomplete.xhtml
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js
Log:
https://jira.jboss.org/browse/RF-8875
modes and client filtering implementation
Modified: trunk/examples/input-demo/src/main/webapp/autocomplete.xhtml
===================================================================
--- trunk/examples/input-demo/src/main/webapp/autocomplete.xhtml 2010-08-30 06:38:28 UTC (rev 19008)
+++ trunk/examples/input-demo/src/main/webapp/autocomplete.xhtml 2010-08-30 07:58:57 UTC (rev 19009)
@@ -17,7 +17,7 @@
block text block text block text block text block text block text
block text block
- <input:autocomplete autocompleteMethod="#{autoCompleteBean.autocomplete}" var="country" fetchValue="#{country.name}">
+ <input:autocomplete mode="" minChars="2" autocompleteMethod="#{autoCompleteBean.autocomplete}" var="country" fetchValue="#{country.name}" showButton="true">
#{country.name} #{country.iso} #{country.domain}
</input:autocomplete>
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js 2010-08-30 06:38:28 UTC (rev 19008)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js 2010-08-30 07:58:57 UTC (rev 19009)
@@ -6,7 +6,19 @@
this.cache = {}
this.cache[this.key] = items || [];
this.values = typeof values != "function" ? values || this.cache[this.key] : values(items);
+ this.useCache = checkValuesPrefix.call(this);
};
+
+ var checkValuesPrefix = function () {
+ var result = true;
+ for (var i = 0; i<this.values.length; i++) {
+ if (this.values[i].indexOf(this.key)!=0) {
+ result = false;
+ break;
+ }
+ }
+ return result;
+ }
var getItems = function (key) {
key = key.toLowerCase();
@@ -45,7 +57,7 @@
var isCached = function (key) {
key = key.toLowerCase();
- return this.cache[key] || this.key.indexOf(key)==0;
+ return this.cache[key] || this.useCache && key.indexOf(this.key)==0;
};
$.extend(rf.utils.Cache.prototype, (function () {
@@ -173,7 +185,7 @@
};
var autoFill = function (inputValue, value) {
- if( this.options.autofill) {
+ if( this.options.autofill && value.toLowerCase().indexOf(inputValue)==0) {
var field = rf.getDomElement(this.fieldId);
var start = rf.Selection.getStart(field);
this.setInputValue(inputValue + value.substring(inputValue.length));
@@ -184,7 +196,7 @@
var callAjax = function(event, value) {
- $(rf.getDomElement(this.id+ID.ITEMS)).removeData().empty();
+ clearItems.call(this);
rf.getDomElement(this.id+ID.VALUE).value = value;
@@ -245,18 +257,24 @@
this.items = $(newItems);
//TODO: works only with simple markup, not with <tr>
$(rf.getDomElement(this.id+ID.ITEMS)).empty().append(newItems);
- }
+ };
+ var clearItems = function () {
+ $(rf.getDomElement(this.id+ID.ITEMS)).removeData().empty();
+ this.items = [];
+ };
+
var onChangeValue = function (event, value) {
selectItem.call(this);
+ this.index = -1;
// value is undefined if called from AutocompleteBase onChange
var subValue = (typeof value == "undefined") ? this.__getSubValue() : value;
+ var oldValue = this.value;
+ this.value = subValue;
if (this.cache && this.cache.isCached(subValue)) {
updateItemsFromCache.call(this, subValue);
- this.index = -1;
- this.value = subValue;
if (this.options.selectFirst) {
if (event.which == rf.KEYS.RETURN || event.type == "click") {
this.setInputValue(subValue);
@@ -265,11 +283,17 @@
}
}
} else {
+ if (event.which == rf.KEYS.RETURN || event.type == "click") {
+ this.setInputValue(subValue);
+ }
if (subValue.length>=this.options.minChars) {
- if (this.options.ajaxMode && this.value!=subValue) {
- this.value = subValue;
+ if (this.options.ajaxMode && oldValue!=subValue) {
this.options.ajaxMode && callAjax.call(this, event, subValue);
}
+ } else {
+ if (this.options.ajaxMode) {
+ clearItems.call(this);
+ }
}
}
15 years
JBoss Rich Faces SVN: r19008 - modules/docs/branches/draft/parent.
by richfaces-svn-commits@lists.jboss.org
Author: SeanRogers
Date: 2010-08-30 02:38:28 -0400 (Mon, 30 Aug 2010)
New Revision: 19008
Modified:
modules/docs/branches/draft/parent/pom.xml
Log:
Updated xslt reference for PDFs
Modified: modules/docs/branches/draft/parent/pom.xml
===================================================================
--- modules/docs/branches/draft/parent/pom.xml 2010-08-29 11:43:19 UTC (rev 19007)
+++ modules/docs/branches/draft/parent/pom.xml 2010-08-30 06:38:28 UTC (rev 19008)
@@ -44,7 +44,7 @@
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jbossorg-docbook-xslt</artifactId>
- <version>1.1.1</version>
+ <version>1.2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.jboss</groupId>
15 years
JBoss Rich Faces SVN: r19007 - branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-08-29 07:43:19 -0400 (Sun, 29 Aug 2010)
New Revision: 19007
Modified:
branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/BundleLoader.java
Log:
RFPL-434
Modified: branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/BundleLoader.java
===================================================================
--- branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/BundleLoader.java 2010-08-29 04:38:11 UTC (rev 19006)
+++ branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/BundleLoader.java 2010-08-29 11:43:19 UTC (rev 19007)
@@ -132,7 +132,7 @@
return viewRoot.getLocale();
}
- return Locale.getDefault();
+ return null;
}
protected ResourceBundle getOrCreateResourceBundle(BundleKey bundleKey) throws MissingResourceException {
@@ -185,6 +185,11 @@
} else {
locale = Locale.getDefault();
}
+
+ if (locale == null) {
+ throw new MissingResourceException("Cannot read locale from application",
+ getClass().getName(), messageKey.toString());
+ }
BundleKey bundleKey = new BundleKey(application.getMessageBundle(), locale);
return getOrCreateResourceBundle(bundleKey);
15 years, 1 month
JBoss Rich Faces SVN: r19006 - in modules/tests/metamer/trunk/application/src/main: webapp/components/richColumn and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: prabhat.jha(a)jboss.com
Date: 2010-08-29 00:38:11 -0400 (Sun, 29 Aug 2010)
New Revision: 19006
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichColumnBean.java
modules/tests/metamer/trunk/application/src/main/webapp/components/richColumn/list.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richColumn/simple.xhtml
Log:
some more features for rich:column
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichColumnBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichColumnBean.java 2010-08-28 19:55:30 UTC (rev 19005)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichColumnBean.java 2010-08-29 04:38:11 UTC (rev 19006)
@@ -22,19 +22,13 @@
package org.richfaces.tests.metamer.bean;
import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
-import javax.faces.bean.ManagedProperty;
import javax.faces.bean.SessionScoped;
import org.richfaces.component.UIColumn;
-
import org.richfaces.tests.metamer.Attributes;
-import org.richfaces.tests.metamer.model.Employee;
-import org.richfaces.tests.metamer.model.Employee.Sex;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -50,13 +44,8 @@
private static final long serialVersionUID = -1L;
private static Logger logger;
- private Attributes attributes;
- @ManagedProperty(value = "#{model.employees}")
- private List<Employee> employees;
- private List<List<Employee>> lists;
- // true = model, false = empty table
- private boolean state;
-
+ private Attributes attributes;
+
/**
* Initializes the managed bean.
*/
@@ -66,29 +55,17 @@
logger.debug("initializing bean " + getClass().getName());
attributes = Attributes.getUIComponentAttributes(UIColumn.class, getClass());
-
-
-// attributes.setAttribute("rendered", true);
-
- // TODO these attributes have to be tested in another way
- // attributes.remove("componentState");
-
- List<Employee> men = new ArrayList<Employee>();
- List<Employee> women = new ArrayList<Employee>();
-
- for (Employee e : employees) {
- if (e.getSex() == Sex.MALE) {
- men.add(e);
- } else {
- women.add(e);
- }
- }
-
- lists = new ArrayList<List<Employee>>();
- lists.add(men);
- lists.add(women);
-
- state = true;
+ attributes.setAttribute("rendered", true);
+ attributes.setAttribute("columnSpan", 1);
+
+ /*breakRowBefore=""
+ colspan=""
+ comparator=""
+ filter=""
+ filterValue=""
+ rendered=""
+ rowspan=""
+ sortOrder=""*/
}
public Attributes getAttributes() {
@@ -99,28 +76,5 @@
this.attributes = attributes;
}
- public List<Employee> getEmployees() {
- return employees;
- }
-
- public void setEmployees(List<Employee> employees) {
- this.employees = employees;
- }
-
- public List<List<Employee>> getLists() {
- return lists;
- }
-
- public void setLists(List<List<Employee>> lists) {
- this.lists = lists;
- }
-
- public boolean isState() {
- return state;
- }
-
- public void setState(boolean state) {
- this.state = state;
- }
-
+
}
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richColumn/list.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richColumn/list.xhtml 2010-08-28 19:55:30 UTC (rev 19005)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richColumn/list.xhtml 2010-08-29 04:38:11 UTC (rev 19006)
@@ -31,7 +31,7 @@
<ui:define name="links">
<metamer:testPageLink id="simple" outcome="simple" value="Simple">
- Simple page that contains blah blah
+ Simple page that contains a table with two columns
</metamer:testPageLink>
</ui:define>
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richColumn/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richColumn/simple.xhtml 2010-08-28 19:55:30 UTC (rev 19005)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richColumn/simple.xhtml 2010-08-29 04:38:11 UTC (rev 19006)
@@ -40,7 +40,35 @@
</ui:define>
<ui:define name="component">
-
+
+ <rich:dataTable id="richDataTable"
+ rendered="true"
+ value="#{model.capitals}"
+ rows="5"
+ var="record"
+ >
+ <rich:column id="columnState"
+ rendered="#{richColumnBean.attributes['rendered'].value}"
+ colspan="#{richColumnBean.attributes['colspan'].value}"
+ sortOrder="#{richColumnBean.attributes['sortOrder'].value}"
+ >
+ <f:facet name="header">
+ <h:outputText id="columnHeaderState" value="State" />
+ </f:facet>
+ <h:outputText value="#{record.state}" />
+ <f:facet name="footer">
+ <h:outputText id="columnFooterState" value="State" />
+ </f:facet>
+ </rich:column>
+ <rich:column id="columnCapital"
+ filter="#{richColumnBean.attributes['filter'].value}"
+ >
+ <f:facet name="header">
+ <h:outputText id="columnCapitalState" value="Capital" />
+ </f:facet>
+ <h:outputText value="#{record.name}" />
+ </rich:column>
+ </rich:dataTable>
</ui:define>
<ui:define name="outOfTemplateAfter">
15 years, 1 month
JBoss Rich Faces SVN: r19005 - in branches/RFPL-434/core/commons: src/main/java/org/richfaces and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-08-28 15:55:30 -0400 (Sat, 28 Aug 2010)
New Revision: 19005
Added:
branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/
branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/BundleLoader.java
branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/InterpolationException.java
branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageBundle.java
branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageFactory.java
branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageInterpolator.java
branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/CoreMessages.java
branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/FacesMessages.java
Modified:
branches/RFPL-434/core/commons/pom.xml
Log:
RFPL-434
Modified: branches/RFPL-434/core/commons/pom.xml
===================================================================
--- branches/RFPL-434/core/commons/pom.xml 2010-08-27 13:58:13 UTC (rev 19004)
+++ branches/RFPL-434/core/commons/pom.xml 2010-08-28 19:55:30 UTC (rev 19005)
@@ -54,6 +54,10 @@
<artifactId>jsf-mock</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
</dependencies>
<scm>
Added: branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/BundleLoader.java
===================================================================
--- branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/BundleLoader.java (rev 0)
+++ branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/BundleLoader.java 2010-08-28 19:55:30 UTC (rev 19005)
@@ -0,0 +1,192 @@
+/*
+ * 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.l10n;
+
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import javax.faces.application.Application;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+
+import com.google.common.base.Function;
+import com.google.common.collect.MapMaker;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class BundleLoader {
+
+ private static final class BundleKey {
+
+ private Locale locale;
+
+ private String baseName;
+
+ public BundleKey(String baseName, Locale locale) {
+ super();
+ this.baseName = baseName;
+ this.locale = locale;
+ }
+
+ public String getBaseName() {
+ return baseName;
+ }
+
+ public Locale getLocale() {
+ return locale;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((baseName == null) ? 0 : baseName.hashCode());
+ result = prime * result + ((locale == null) ? 0 : locale.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ BundleKey other = (BundleKey) obj;
+ if (baseName == null) {
+ if (other.baseName != null) {
+ return false;
+ }
+ } else if (!baseName.equals(other.baseName)) {
+ return false;
+ }
+ if (locale == null) {
+ if (other.locale != null) {
+ return false;
+ }
+ } else if (!locale.equals(other.locale)) {
+ return false;
+ }
+ return true;
+ }
+
+ }
+
+ private static ConcurrentMap<ClassLoader, ConcurrentMap<BundleKey, ResourceBundle>> bundlesCache = new MapMaker()
+ .weakKeys().makeComputingMap(new Function<ClassLoader, ConcurrentMap<BundleKey, ResourceBundle>>() {
+
+ public ConcurrentMap<BundleKey, ResourceBundle> apply(ClassLoader from) {
+ return new ConcurrentHashMap<BundleKey, ResourceBundle>();
+ };
+
+ });
+
+ private ClassLoader getClassLoader() {
+ return Thread.currentThread().getContextClassLoader();
+ }
+
+ private MessageBundle asMessageBundle(Enum<?> messageKey) throws IllegalArgumentException {
+ MessageBundle bundleAnnotation = messageKey.getClass().getAnnotation(MessageBundle.class);
+
+ if (bundleAnnotation == null) {
+ throw new IllegalArgumentException(MessageFormat.format(
+ "Cannot detect baseName for enumeration {0} in class {1}", messageKey.toString(), messageKey.getClass()
+ .getName()));
+ }
+
+ return bundleAnnotation;
+ }
+
+ private Locale detectLocale(FacesContext context) {
+ UIViewRoot viewRoot = context.getViewRoot();
+ if (viewRoot != null && viewRoot.getLocale() != null) {
+ return viewRoot.getLocale();
+ }
+
+ return Locale.getDefault();
+ }
+
+ protected ResourceBundle getOrCreateResourceBundle(BundleKey bundleKey) throws MissingResourceException {
+ ClassLoader loader = getClassLoader();
+ ConcurrentMap<BundleKey, ResourceBundle> bundles = bundlesCache.get(loader);
+ ResourceBundle bundle = bundles.get(bundleKey);
+
+ if (bundle == null) {
+ bundle = ResourceBundle.getBundle(bundleKey.getBaseName(), bundleKey.getLocale(), loader);
+ bundles.put(bundleKey, bundle);
+ }
+
+ return bundle;
+ }
+
+ public ResourceBundle getBundle(Enum<?> messageKey, Locale locale) throws MissingResourceException,
+ IllegalArgumentException {
+ MessageBundle bundleAnnotation = asMessageBundle(messageKey);
+ BundleKey bundleKey = new BundleKey(bundleAnnotation.baseName(), locale);
+
+ ResourceBundle bundle = getOrCreateResourceBundle(bundleKey);
+
+ return bundle;
+ }
+
+ public ResourceBundle getApplicationBundle(FacesContext facesContext, Enum<?> messageKey, boolean useDefaultLocale)
+ throws MissingResourceException, IllegalArgumentException {
+
+ MessageBundle messageBundle = asMessageBundle(messageKey);
+
+ if (facesContext == null) {
+ throw new MissingResourceException("FacesContext is null", getClass().getName(), messageKey.toString());
+ }
+
+ if (!messageBundle.useApplicationBundle()) {
+ throw new MissingResourceException("MessageBundle annotation doesn't declare application bundle as used",
+ getClass().getName(), messageKey.toString());
+ }
+
+ Application application = facesContext.getApplication();
+
+ if (application == null || application.getMessageBundle() == null) {
+ throw new MissingResourceException("Cannot read message bundle name from application",
+ getClass().getName(), messageKey.toString());
+ }
+
+ Locale locale;
+ if (!useDefaultLocale) {
+ locale = detectLocale(facesContext);
+ } else {
+ locale = Locale.getDefault();
+ }
+
+ BundleKey bundleKey = new BundleKey(application.getMessageBundle(), locale);
+ return getOrCreateResourceBundle(bundleKey);
+ }
+}
Added: branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/InterpolationException.java
===================================================================
--- branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/InterpolationException.java (rev 0)
+++ branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/InterpolationException.java 2010-08-28 19:55:30 UTC (rev 19005)
@@ -0,0 +1,74 @@
+/*
+ * 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.l10n;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class InterpolationException extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 218954633540769880L;
+
+ private String messageKey;
+
+ /**
+ *
+ */
+ public InterpolationException() {
+ super();
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public InterpolationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * @param message
+ */
+ public InterpolationException(String message) {
+ super(message);
+ }
+
+ /**
+ * @param cause
+ */
+ public InterpolationException(Throwable cause) {
+ super(cause);
+ }
+
+ public InterpolationException initMessageKey(String messageKey) {
+ this.messageKey = messageKey;
+ return this;
+ }
+
+ public String getMessageKey() {
+ return messageKey;
+ }
+}
Added: branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageBundle.java
===================================================================
--- branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageBundle.java (rev 0)
+++ branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageBundle.java 2010-08-28 19:55:30 UTC (rev 19005)
@@ -0,0 +1,41 @@
+/*
+ * 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.l10n;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)Target(ElementType.TYPE)
+public @interface MessageBundle {
+
+ public String baseName();
+
+ public boolean useApplicationBundle();
+
+}
Added: branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageFactory.java
===================================================================
--- branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageFactory.java (rev 0)
+++ branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageFactory.java 2010-08-28 19:55:30 UTC (rev 19005)
@@ -0,0 +1,154 @@
+/*
+ * 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.l10n;
+
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.application.FacesMessage.Severity;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class MessageFactory {
+
+ private enum BundleLoaderInvoker {
+ application {
+ @Override
+ public ResourceBundle getBundle(BundleLoader bundleLoader, FacesContext context, Enum<?> messageKey,
+ Locale locale) throws MissingResourceException {
+
+ return bundleLoader.getApplicationBundle(context, messageKey, false);
+ }
+ },
+
+ annotation {
+ @Override
+ public ResourceBundle getBundle(BundleLoader bundleLoader, FacesContext context, Enum<?> messageKey,
+ Locale locale) throws MissingResourceException {
+
+ return bundleLoader.getBundle(messageKey, locale);
+ }
+ },
+
+ applicationDefaultLocale {
+ @Override
+ public ResourceBundle getBundle(BundleLoader bundleLoader, FacesContext context, Enum<?> messageKey,
+ Locale locale) throws MissingResourceException {
+
+ return bundleLoader.getApplicationBundle(context, messageKey, true);
+ }
+ },
+
+ anotationDefaultLocale {
+ @Override
+ public ResourceBundle getBundle(BundleLoader bundleLoader, FacesContext context, Enum<?> messageKey,
+ Locale locale) throws MissingResourceException {
+
+ return bundleLoader.getBundle(messageKey, Locale.getDefault());
+ }
+ };
+
+ public abstract ResourceBundle getBundle(BundleLoader bundleLoader, FacesContext context, Enum<?> messageKey,
+ Locale locale) throws MissingResourceException;
+ }
+
+ private BundleLoader bundleLoader;
+
+ public MessageFactory(BundleLoader bundleLoader) {
+ super();
+ this.bundleLoader = bundleLoader;
+ }
+
+ public FacesMessage createMessage(FacesContext facesContext, Enum<?> messageKey, Object... args) {
+ return createMessage(facesContext, FacesMessage.SEVERITY_INFO, messageKey, args);
+ }
+
+ public FacesMessage createMessage(FacesContext facesContext, Severity severity, Enum<?> messageKey, Object... args) {
+ Locale locale;
+ FacesMessage result = null;
+
+ if (facesContext != null) {
+ UIViewRoot viewRoot = facesContext.getViewRoot();
+
+ if (viewRoot != null) {
+ locale = viewRoot.getLocale();
+
+ if (locale != null) {
+ result = createMessage(facesContext, severity, locale, messageKey, args);
+ }
+ }
+ }
+
+ if (result == null) {
+ locale = Locale.getDefault();
+ result = createMessage(facesContext, severity, locale, messageKey, args);
+ }
+
+ return result;
+ }
+
+ protected FacesMessage createMessage(FacesContext context, Severity severity, Locale locale, Enum<?> messageKey,
+ Object... args) {
+
+ MessageBundle messageBundle = messageKey.getClass().getAnnotation(MessageBundle.class);
+
+ if (messageBundle == null) {
+ return null;
+ }
+
+ String messageId = messageKey.toString();
+
+ String summary = null;
+ String detail = null;
+
+ for (BundleLoaderInvoker invoker : BundleLoaderInvoker.values()) {
+ try {
+ ResourceBundle bundle = invoker.getBundle(bundleLoader, context, messageKey, locale);
+ summary = bundle.getString(messageId);
+ detail = bundle.getString(messageId + "_detail");
+ } catch (MissingResourceException e) {
+ // do nothing
+ }
+
+ if (summary != null) {
+ break;
+ }
+ }
+
+ String formattedSummary = MessageFormat.format(summary, args);
+ String formattedDetail = null;
+
+ if (detail != null) {
+ formattedDetail = MessageFormat.format(detail, args);
+ }
+
+ return new FacesMessage(severity, formattedSummary, formattedDetail);
+ }
+
+}
Added: branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageInterpolator.java
===================================================================
--- branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageInterpolator.java (rev 0)
+++ branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageInterpolator.java 2010-08-28 19:55:30 UTC (rev 19005)
@@ -0,0 +1,87 @@
+/*
+ * 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.l10n;
+
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class MessageInterpolator {
+
+ private BundleLoader bundleLoader;
+
+ private boolean checkApplicationBundle;
+
+ public MessageInterpolator(BundleLoader bundleLoader) {
+ this(bundleLoader, false);
+ }
+
+ public MessageInterpolator(BundleLoader bundleLoader, boolean checkApplicationBundle) {
+ super();
+ this.bundleLoader = bundleLoader;
+ this.checkApplicationBundle = checkApplicationBundle;
+ }
+
+ protected String getMessageKey(Enum<?> key) {
+ return key.toString();
+ }
+
+ protected String getPattern(Locale locale, Enum<?> key) throws MissingResourceException {
+ String messageKey = getMessageKey(key);
+ try {
+ ResourceBundle bundle = bundleLoader.getBundle(key, locale);
+ String messagePattern = bundle.getString(messageKey);
+
+ return messagePattern;
+ } catch (MissingResourceException e) {
+ if (checkApplicationBundle) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ try {
+ ResourceBundle bundle = bundleLoader.getApplicationBundle(facesContext, key, false);
+ return bundle.getString(messageKey);
+ } catch (MissingResourceException e1) {
+ ResourceBundle bundle = bundleLoader.getApplicationBundle(facesContext, key, true);
+ return bundle.getString(messageKey);
+ }
+ } else {
+ throw e;
+ }
+ }
+ }
+
+ public String interpolate(Locale locale, Enum<?> key, Object... args) throws InterpolationException {
+ try {
+ String messagePattern = getPattern(locale, key);
+ return MessageFormat.format(messagePattern, args);
+ } catch (MissingResourceException e) {
+ throw new InterpolationException(e).initMessageKey(key.toString());
+ }
+ }
+
+}
Added: branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/CoreMessages.java
===================================================================
--- branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/CoreMessages.java (rev 0)
+++ branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/CoreMessages.java 2010-08-28 19:55:30 UTC (rev 19005)
@@ -0,0 +1,36 @@
+/*
+ * 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.log;
+
+import org.richfaces.l10n.MessageBundle;
+
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@MessageBundle(baseName = "org.richfaces.Messages", useApplicationBundle = true)
+public final class CoreMessages {
+
+ private CoreMessages() {}
+
+}
Added: branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/FacesMessages.java
===================================================================
--- branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/FacesMessages.java (rev 0)
+++ branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/FacesMessages.java 2010-08-28 19:55:30 UTC (rev 19005)
@@ -0,0 +1,109 @@
+/*
+ * 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.log;
+
+import javax.faces.application.FacesMessage;
+
+import org.richfaces.l10n.MessageBundle;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@MessageBundle(baseName = FacesMessage.FACES_MESSAGES, useApplicationBundle = true)
+public enum FacesMessages {
+
+ UIINPUT_CONVERSION("javax.faces.component.UIInput.CONVERSION"),
+ UIINPUT_REQUIRED("javax.faces.component.UIInput.REQUIRED"),
+ UIINPUT_UPDATE("javax.faces.component.UIInput.UPDATE"),
+ UISELECTONE_INVALID("javax.faces.component.UISelectOne.INVALID"),
+ UISELECTMANY_INVALID("javax.faces.component.UISelectMany.INVALID"),
+ BIG_DECIMAL_CONVERTER_DECIMAL("javax.faces.converter.BigDecimalConverter.DECIMAL"),
+ BIG_DECIMAL_CONVERTER_DECIMAL_DETAIL("javax.faces.converter.BigDecimalConverter.DECIMAL_detail"),
+ BIG_INTEGER_CONVERTER_BIGINTEGER("javax.faces.converter.BigIntegerConverter.BIGINTEGER"),
+ BIG_INTEGER_CONVERTER_BIGINTEGER_DETAIL("javax.faces.converter.BigIntegerConverter.BIGINTEGER_detail"),
+ BOOLEAN_CONVERTER_BOOLEAN("javax.faces.converter.BooleanConverter.BOOLEAN"),
+ BOOLEAN_CONVERTER_BOOLEAN_DETAIL("javax.faces.converter.BooleanConverter.BOOLEAN_detail"),
+ BYTE_CONVERTER_BYTE("javax.faces.converter.ByteConverter.BYTE"),
+ BYTE_CONVERTER_BYTE_DETAIL("javax.faces.converter.ByteConverter.BYTE_detail"),
+ CHARACTER_CONVERTER_CHARACTER("javax.faces.converter.CharacterConverter.CHARACTER"),
+ CHARACTER_CONVERTER_CHARACTER_DETAIL("javax.faces.converter.CharacterConverter.CHARACTER_detail"),
+ DATE_TIME_CONVERTER_DATE("javax.faces.converter.DateTimeConverter.DATE"),
+ DATE_TIME_CONVERTER_DATE_DETAIL("javax.faces.converter.DateTimeConverter.DATE_detail"),
+ DATE_TIME_CONVERTER_TIME("javax.faces.converter.DateTimeConverter.TIME"),
+ DATE_TIME_CONVERTER_TIME_DETAIL("javax.faces.converter.DateTimeConverter.TIME_detail"),
+ DATE_TIME_CONVERTER_DATETIME("javax.faces.converter.DateTimeConverter.DATETIME"),
+ DATE_TIME_CONVERTER_DATETIME_DETAIL("javax.faces.converter.DateTimeConverter.DATETIME_detail"),
+ DATE_TIME_CONVERTER_PATTERN_TYPE("javax.faces.converter.DateTimeConverter.PATTERN_TYPE"),
+ DOUBLE_CONVERTER_DOUBLE("javax.faces.converter.DoubleConverter.DOUBLE"),
+ DOUBLE_CONVERTER_DOUBLE_DETAIL("javax.faces.converter.DoubleConverter.DOUBLE_detail"),
+ ENUM_CONVERTER_ENUM("javax.faces.converter.EnumConverter.ENUM"),
+ ENUM_CONVERTER_ENUM_DETAIL("javax.faces.converter.EnumConverter.ENUM_detail"),
+ ENUM_CONVERTER_ENUM_NO_CLASS("javax.faces.converter.EnumConverter.ENUM_NO_CLASS"),
+ ENUM_CONVERTER_ENUM_NO_CLASS_DETAIL("javax.faces.converter.EnumConverter.ENUM_NO_CLASS_detail"),
+ FLOAT_CONVERTER_FLOAT("javax.faces.converter.FloatConverter.FLOAT"),
+ FLOAT_CONVERTER_FLOAT_DETAIL("javax.faces.converter.FloatConverter.FLOAT_detail"),
+ INTEGER_CONVERTER_INTEGER("javax.faces.converter.IntegerConverter.INTEGER"),
+ INTEGER_CONVERTER_INTEGER_DETAIL("javax.faces.converter.IntegerConverter.INTEGER_detail"),
+ LONG_CONVERTER_LONG("javax.faces.converter.LongConverter.LONG"),
+ LONG_CONVERTER_LONG_DETAIL("javax.faces.converter.LongConverter.LONG_detail"),
+ NUMBER_CONVERTER_CURRENCY("javax.faces.converter.NumberConverter.CURRENCY"),
+ NUMBER_CONVERTER_CURRENCY_DETAIL("javax.faces.converter.NumberConverter.CURRENCY_detail"),
+ NUMBER_CONVERTER_PERCENT("javax.faces.converter.NumberConverter.PERCENT"),
+ NUMBER_CONVERTER_PERCENT_DETAIL("javax.faces.converter.NumberConverter.PERCENT_detail"),
+ NUMBER_CONVERTER_NUMBER("javax.faces.converter.NumberConverter.NUMBER"),
+ NUMBER_CONVERTER_NUMBER_DETAIL("javax.faces.converter.NumberConverter.NUMBER_detail"),
+ NUMBER_CONVERTER_PATTERN("javax.faces.converter.NumberConverter.PATTERN"),
+ NUMBER_CONVERTER_PATTERN_DETAIL("javax.faces.converter.NumberConverter.PATTERN_detail"),
+ SHORT_CONVERTER_SHORT("javax.faces.converter.ShortConverter.SHORT"),
+ SHORT_CONVERTER_SHORT_DETAIL("javax.faces.converter.ShortConverter.SHORT_detail"),
+ CONVERTER_STRING("javax.faces.converter.STRING"),
+ DOUBLE_RANGE_VALIDATOR_MAXIMUM("javax.faces.validator.DoubleRangeValidator.MAXIMUM"),
+ DOUBLE_RANGE_VALIDATOR_MINIMUM("javax.faces.validator.DoubleRangeValidator.MINIMUM"),
+ DOUBLE_RANGE_VALIDATOR_NOT_IN_RANGE("javax.faces.validator.DoubleRangeValidator.NOT_IN_RANGE"),
+ DOUBLE_RANGE_VALIDATOR_TYPE("javax.faces.validator.DoubleRangeValidator.TYPE"),
+ LENGTH_VALIDATOR_MAXIMUM("javax.faces.validator.LengthValidator.MAXIMUM"),
+ LENGTH_VALIDATOR_MINIMUM("javax.faces.validator.LengthValidator.MINIMUM"),
+ LONG_RANGE_VALIDATOR_MAXIMUM("javax.faces.validator.LongRangeValidator.MAXIMUM"),
+ LONG_RANGE_VALIDATOR_MINIMUM("javax.faces.validator.LongRangeValidator.MINIMUM"),
+ LONG_RANGE_VALIDATOR_NOT_IN_RANGE("javax.faces.validator.LongRangeValidator.NOT_IN_RANGE"),
+ LONG_RANGE_VALIDATOR_TYPE("javax.faces.validator.LongRangeValidator.TYPE"),
+ VALIDATOR_NOT_IN_RANGE("javax.faces.validator.NOT_IN_RANGE"),
+ REGEX_VALIDATOR_PATTERN_NOT_SET("javax.faces.validator.RegexValidator.PATTERN_NOT_SET"),
+ REGEX_VALIDATOR_PATTERN_NOT_SET_DETAIL("javax.faces.validator.RegexValidator.PATTERN_NOT_SET_detail"),
+ REGEX_VALIDATOR_NOT_MATCHED("javax.faces.validator.RegexValidator.NOT_MATCHED"),
+ REGEX_VALIDATOR_NOT_MATCHED_DETAIL("javax.faces.validator.RegexValidator.NOT_MATCHED_detail"),
+ REGEX_VALIDATOR_MATCH_EXCEPTION("javax.faces.validator.RegexValidator.MATCH_EXCEPTION"),
+ REGEX_VALIDATOR_MATCH_EXCEPTION_DETAIL("javax.faces.validator.RegexValidator.MATCH_EXCEPTION_detail"),
+ BEAN_VALIDATOR_MESSAGE("javax.faces.validator.BeanValidator.MESSAGE");
+
+ private String key;
+
+ private FacesMessages(String key) {
+ this.key = key;
+ }
+
+ @Override
+ public String toString() {
+ return key;
+ }
+}
15 years, 1 month
JBoss Rich Faces SVN: r19004 - trunk/ui/input/ui/src/test/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-08-27 09:58:13 -0400 (Fri, 27 Aug 2010)
New Revision: 19004
Modified:
trunk/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceInputRendererTest.java
Log:
remove @Ignore annotation
Modified: trunk/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceInputRendererTest.java
===================================================================
--- trunk/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceInputRendererTest.java 2010-08-27 13:10:15 UTC (rev 19003)
+++ trunk/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceInputRendererTest.java 2010-08-27 13:58:13 UTC (rev 19004)
@@ -89,7 +89,6 @@
}
@Test
- @Ignore("Updates to RF-9132 broke this test - it needs to be fixed, but is blocking M2 release")
public void testRenderEditState() throws Exception {
HtmlPage page = environment.getPage("/test.jsf");
15 years, 1 month