Comments (26)
Reported by rogerk
from javaserverfaces-spec.
@edburns said:
Move to p3 feature.
from javaserverfaces-spec.
@edburns said:
Give this to Roger.
from javaserverfaces-spec.
rogerk said:
Submitted initial proposal.
from javaserverfaces-spec.
rogerk said:
This change bundle implements this issue with the following key points:
-
a "label" attribute has been added to all input components
-
the value of the "label" attribute is substituted at the start
of the implementation's default message (defined in Messages.properties).
For example ( {1} is the placeholder for "label" value here:
javax.faces.converter.BigDecimalConverter.DECIMAL={1}''
{0}
'' must be a
signed decimal number. -
the "label" can be a binding expression that may refer to a resource bundle
key that is the I18n'd label. For an example of this - check out
converter04.jsp under the RI's systest/web included in the change bundle.
(thanks to Adam Winer for his suggestion and code sample)
SECTION: Modified Files
M jsf-api/build.xml
- added entry to create MessageFactory.java for converters
M jsf-api/doc/input-attrs.xml - generated from input-props.xml
M jsf-api/doc/input-props.xml - added "label" attribute
M jsf-api/doc/standard-html-renderkit.xml - generated - includes "label" attribute
M jsf-api/src/javax/faces/convert/BigDecimalConverter.java
M jsf-api/src/javax/faces/convert/BigIntegerConverter.java
M jsf-api/src/javax/faces/convert/BooleanConverter.java
M jsf-api/src/javax/faces/convert/ByteConverter.java
M jsf-api/src/javax/faces/convert/CharacterConverter.java
M jsf-api/src/javax/faces/convert/DateTimeConverter.java
M jsf-api/src/javax/faces/convert/DoubleConverter.java
M jsf-api/src/javax/faces/convert/FloatConverter.java
M jsf-api/src/javax/faces/convert/IntegerConverter.java
M jsf-api/src/javax/faces/convert/LongConverter.java
M jsf-api/src/javax/faces/convert/NumberConverter.java
M jsf-api/src/javax/faces/convert/ShortConverter.java - added message constants; use them in ConverterException(s)
M jsf-api/src/javax/faces/validator/DoubleRangeValidator.java
M jsf-api/src/javax/faces/validator/LengthValidator.java
M jsf-api/src/javax/faces/validator/LongRangeValidator.java
M jsf-api/src/javax/faces/validator/Validator.java - updated javadocs;
- include component label in the parameter array for messages
M jsf-ri/src/javax/faces/Messages.properties
M jsf-ri/src/javax/faces/Messages_de.properties
M jsf-ri/src/javax/faces/Messages_es.properties
M jsf-ri/src/javax/faces/Messages_fr.properties - updated to include converter messages;
- also included new "label" value placeholder at the beginning
of messages.
M jsf-ri/systest/build-tests.xml - included new test for converter messages
M jsf-ri/systest/src/com/sun/faces/CustomMessages.properties - contains a component label to illustrate the inclusion of the label
from a resource bundle.
M jsf-ri/systest/src/com/sun/faces/jsptest/ConverterTestCase.java
M jsf-ri/systest/src/com/sun/faces/jsptest/ValidatorTestCase.java - included tests for messages
M jsf-ri/systest/web/converter03.jsp
M jsf-tools/template-src/MessageFactory.java - include specialized FacesMessage class (inner) that performs late
- binding evaluation for message substitution parameters.
A jsf-ri/systest/web/converter04.jsp
A jsf-ri/systest/web/validator03.jsp
- new test pages
from javaserverfaces-spec.
rogerk said:
Created an attachment (id=11)
Change bundle and new files for issue 6.
from javaserverfaces-spec.
rogerk said:
Changes to reflect last set of requests from EG. Key points:
-
a "label" attribute has been added to all input components
-
the "label" attribute value is added to the end of the Object
parameter array (passed as an arg to MessageFactory.getMessage) -
if the label attribute has not been specified as a literal or
binding expression (i.e. it is null), then the component's client id
will be used as the default label value. -
the value of the "label" attribute is substituted at the start
of the implementation's default message (defined in Messages.properties).
For example ( {1} is the placeholder for "label" value here:
javax.faces.converter.BigDecimalConverter.DECIMAL={1}''
{0}
'' must be a
signed decimal number. -
the "label" can be a binding expression that may refer to a resource bundle
key that is the I18n'd label. For an example of this - check out
converter04.jsp under the RI's systest/web included in the change bundle.
(thanks to Adam Winer for his suggestion and code sample)
SECTION: Modified Files
M jsf-api/build.xml
M jsf-api/doc/input-attrs.xml
M jsf-api/doc/input-props.xml
M jsf-api/doc/standard-html-renderkit.xml
M jsf-api/src/javax/faces/convert/BigDecimalConverter.java
M jsf-api/src/javax/faces/convert/BigIntegerConverter.java
M jsf-api/src/javax/faces/convert/BooleanConverter.java
M jsf-api/src/javax/faces/convert/ByteConverter.java
M jsf-api/src/javax/faces/convert/CharacterConverter.java
M jsf-api/src/javax/faces/convert/DateTimeConverter.java
M jsf-api/src/javax/faces/convert/DoubleConverter.java
M jsf-api/src/javax/faces/convert/FloatConverter.java
M jsf-api/src/javax/faces/convert/IntegerConverter.java
M jsf-api/src/javax/faces/convert/LongConverter.java
M jsf-api/src/javax/faces/convert/NumberConverter.java
M jsf-api/src/javax/faces/convert/ShortConverter.java
M jsf-api/src/javax/faces/validator/DoubleRangeValidator.java
M jsf-api/src/javax/faces/validator/LengthValidator.java
M jsf-api/src/javax/faces/validator/LongRangeValidator.java
M jsf-api/src/javax/faces/validator/Validator.java
M jsf-ri/src/javax/faces/Messages.properties
M jsf-ri/src/javax/faces/Messages_de.properties
M jsf-ri/src/javax/faces/Messages_es.properties
M jsf-ri/src/javax/faces/Messages_fr.properties
M jsf-ri/systest/build-tests.xml
M jsf-ri/systest/src/com/sun/faces/CustomMessages.properties
M jsf-ri/systest/src/com/sun/faces/jsptest/ConverterTestCase.java
M jsf-ri/systest/src/com/sun/faces/jsptest/ValidatorTestCase.java
M jsf-ri/systest/web/converter03.jsp
M jsf-tools/template-src/MessageFactory.java
A jsf-ri/systest/web/converter04.jsp
A jsf-ri/systest/web/validator03.jsp
For final EG discussion on this issue:
http://archives.java.sun.com/cgi-bin/wa?A2=ind0502&L=jsr-252-eg&F=&S=&X=1E63493BEBE56FA37C&[email protected]&P=3866
from javaserverfaces-spec.
rogerk said:
Created an attachment (id=12)
Change Bundle For Issue 6
from javaserverfaces-spec.
rogerk said:
Created another attachment that does not include input-attrs.xml.
from javaserverfaces-spec.
rogerk said:
Created an attachment (id=14)
Latest Change bundle For Issue 6.
from javaserverfaces-spec.
@edburns said:
RK> Changes to reflect last set of requests from EG. Key points:
RK>
RK> - a "label" attribute has been added to all input components
RK> - the "label" attribute value is added to the end of the Object
RK> parameter array (passed as an arg to MessageFactory.getMessage)
RK> - if the label attribute has not been specified as a literal or
RK> binding expression (i.e. it is null), then the component's client id
RK> will be used as the default label value.
RK> - the value of the "label" attribute is substituted at the start
RK> of the implementation's default message (defined in Messages.properties).
RK> For example (
{1} is the placeholder for "label" value here:
RK> javax.faces.converter.BigDecimalConverter.DECIMAL={1}
''
{0}
'' must be a
RK> signed decimal number.
RK> - the "label" can be a binding expression that may refer to a resource bundle
RK> key that is the I18n'd label. For an example of this - check out
RK> converter04.jsp under the RI's systest/web included in the change bundle.
RK> (thanks to Adam Winer for his suggestion and code sample)
RK>
RK> SECTION: Modified Files
RK> ----------------------------
RK> M jsf-api/build.xml
Ok.
RK> M jsf-api/doc/input-attrs.xml
Don't check this in. Jayashri has CVS removed it. *-attrs.xml files
must not be checked in. They are generated by the build process.
RK> M jsf-api/doc/input-props.xml
I don't like the description.
- A presentable name for this component that can be used
- in messages.
How about:
A localized user presentable name for this component that can be used in messages relating to that component.RK> M jsf-api/doc/standard-html-renderkit.xml
Did you edit this file directly? You have to edit the shr-base.xml one,
and check in the edited and generated ones.
RK> M jsf-api/src/javax/faces/convert/BigDecimalConverter.java
The javadoc for the DECIMAL appears to have a parameter list ordering
mismatch. The label is second in the javadoc, but last in the parameter
list. Looks like the javadoc is wrong.
I know you copied and pasted the method
- private Object getLabel(FacesContext context, UIComponent component) {
into every class because there was no better place to put it,
but...there is, IMHO. Put it as a package private static method on
MessageFactory.java. MessageFactory is necessarily in every package
that would use getLabel(). Also, as a nit, there's no need for a local
variable to store the componentLabel, you can just invoke it in the
Object [] argument list. Please remove the copied and pasted getLabel()
from all converter and validator classes and use the one on
MessageFactory instead.
RK> M jsf-api/src/javax/faces/convert/BigIntegerConverter.java
- the same apparent ordering mismatch as in BigDecimal appears to be
here as well.
RK> M jsf-api/src/javax/faces/convert/BooleanConverter.java
- Same nit about the local variable for componentLabel.
RK> M jsf-api/src/javax/faces/convert/ByteConverter.java
- javadoc for both messages has two substitution params, code has two.
RK> M jsf-api/src/javax/faces/convert/DateTimeConverter.java
RK> M jsf-api/src/javax/faces/convert/DoubleConverter.java
RK> M jsf-api/src/javax/faces/convert/FloatConverter.java
RK> M jsf-api/src/javax/faces/convert/IntegerConverter.java
RK> M jsf-api/src/javax/faces/convert/LongConverter.java
RK> M jsf-api/src/javax/faces/convert/NumberConverter.java
RK> M jsf-api/src/javax/faces/convert/ShortConverter.java
- ordering mismatch, please check all messages in these classes for
ordering correctness.
RK> M jsf-api/src/javax/faces/validator/DoubleRangeValidator.java
- the NOT_IN_RANGE message doesn't mention the label. Can you also please
check that other existing messages mention the label as appropriate?
RK> M jsf-api/src/javax/faces/validator/LengthValidator.java
- The diff on this one suffered from the ^M problem. In your revised
change-bundle, can you please rectify it?
RK> M jsf-api/src/javax/faces/validator/LongRangeValidator.java
Ok.
RK> M jsf-api/src/javax/faces/validator/Validator.java
Ok.
RK> M jsf-ri/src/javax/faces/Messages.properties
RK> M jsf-ri/src/javax/faces/Messages_de.properties
RK> M jsf-ri/src/javax/faces/Messages_es.properties
RK> M jsf-ri/src/javax/faces/Messages_fr.properties
RK> M jsf-tools/template-src/MessageFactory.java
-
I still don't like the idea of using "the last one" as the slot for
the label. In fact, I dislike it so much, I want to propose an
alternate solution. This solution doesn't require changing any of the
converters above (other than what I've already suggested).
java.text.MessageFormat says the number in the {n}can be 0 - 9.
Rather than the "last" being special, let's just use 9. That way, we
have several chances to add parameters without changing any code
before we run out. To affect this proposal, modify
MessageFactory.getFormattedString() to create a 10 element array where
the element at index 9 is the last element from the params array, and
the first elements of the params array are copied in order at the
beginning of the array. Any intervening elements in the 10 element
array are filled with the empty string. Will this work?
Please produce another change-bundle.
Thanks,
Ed
from javaserverfaces-spec.
@edburns said:
status enact
from javaserverfaces-spec.
rogerk said:
M jsf-api/build.xml
- added entry to create MessageFactory.java for converters
M jsf-api/doc/input-attrs.xml - generated from input-props.xml
M jsf-api/doc/input-props.xml - added "label" attribute
M jsf-api/doc/standard-html-renderkit.xml - generated - includes "label" attribute
M jsf-api/src/javax/faces/convert/BigDecimalConverter.java
M jsf-api/src/javax/faces/convert/BigIntegerConverter.java
M jsf-api/src/javax/faces/convert/BooleanConverter.java
M jsf-api/src/javax/faces/convert/ByteConverter.java
M jsf-api/src/javax/faces/convert/CharacterConverter.java
M jsf-api/src/javax/faces/convert/DateTimeConverter.java
M jsf-api/src/javax/faces/convert/DoubleConverter.java
M jsf-api/src/javax/faces/convert/FloatConverter.java
M jsf-api/src/javax/faces/convert/IntegerConverter.java
M jsf-api/src/javax/faces/convert/LongConverter.java
M jsf-api/src/javax/faces/convert/NumberConverter.java
M jsf-api/src/javax/faces/convert/ShortConverter.java - added message constants; use them in ConverterException(s)
M jsf-api/src/javax/faces/validator/DoubleRangeValidator.java
M jsf-api/src/javax/faces/validator/LengthValidator.java
M jsf-api/src/javax/faces/validator/LongRangeValidator.java
M jsf-api/src/javax/faces/validator/Validator.java - updated javadocs;
- include component label in the parameter array for messages
M jsf-ri/src/javax/faces/Messages.properties
M jsf-ri/src/javax/faces/Messages_de.properties
M jsf-ri/src/javax/faces/Messages_es.properties
M jsf-ri/src/javax/faces/Messages_fr.properties - updated to include converter messages;
- also included new "label" value placeholder at the beginning
of messages.
M jsf-ri/systest/build-tests.xml - included new test for converter messages
M jsf-ri/systest/src/com/sun/faces/CustomMessages.properties - contains a component label to illustrate the inclusion of the label
from a resource bundle.
M jsf-ri/systest/src/com/sun/faces/jsptest/ConverterTestCase.java
M jsf-ri/systest/src/com/sun/faces/jsptest/ValidatorTestCase.java - included tests for messages
M jsf-ri/systest/web/converter03.jsp
M jsf-tools/template-src/MessageFactory.java - include specialized FacesMessage class (inner) that performs late
- binding evaluation for message substitution parameters.
A jsf-ri/systest/web/converter04.jsp
A jsf-ri/systest/web/validator03.jsp
- new test pages
from javaserverfaces-spec.
rogerk said:
Created an attachment (id=15)
Change bundle for this issue.
from javaserverfaces-spec.
@edburns said:
Looks good, r=edburns! Close this one!
from javaserverfaces-spec.
rogerk said:
checked in.
from javaserverfaces-spec.
@edburns said:
Prepare to delete "spec" subcomponent.
from javaserverfaces-spec.
@edburns said:
Move all to 1.2
from javaserverfaces-spec.
@manfredriem said:
Closing resolved issue out
from javaserverfaces-spec.
File: issue-6.zip.gz
Attached By: rogerk
from javaserverfaces-spec.
File: issue-6.zip.gz
Attached By: rogerk
from javaserverfaces-spec.
File: issue-6.zip.gz
Attached By: rogerk
from javaserverfaces-spec.
File: issue-6.zip.gz
Attached By: rogerk
from javaserverfaces-spec.
Was assigned to rogerk
from javaserverfaces-spec.
This issue was imported from java.net JIRA JAVASERVERFACES_SPEC_PUBLIC-6
from javaserverfaces-spec.
Marked as fixed on Thursday, March 4th 2010, 6:09:25 am
from javaserverfaces-spec.
Related Issues (20)
- CDI shortcut for search expressions HOT 2
- ActionListener and PhaseListener declared in Facelet: Injectable or not? HOT 1
- ProtectedViewException for a protectedview access while checking the OriginHeader HOT 1
- JSF 2.3 Table 5-3 JSF artifacts eligible for injection - Constructor Injection - Not supported HOT 1
- 11.4.6 should specify "search-expression-context-factory" rather than "search-expression-context-kit-factory" HOT 1
- wrong link to Mojarra on spec front page HOT 1
- JSF 2.3 spec section 2.5.2.1 typo HOT 1
- ResourceVisitOption.TOP_LEVEL_VIEWS_ONLY clarification HOT 1
- Add PartialResponseWriterWrapper HOT 3
- StringIndexOutOfBoundsException when using jsf 2.3.3 on tomcat 9.0.2 HOT 2
- Determine url of h:outputLink at click time HOT 4
- Implement cc:insertPassthroughAttributes HOT 1
- importConstants should be allowed everywhere, not only in f:metadata HOT 3
- JSF 2.3 with Java 10&11 not recognizing generic types with f:viewParam HOT 2
- Make javascript functions created by h:commandScript return a Promise HOT 1
- javax.faces.annotation.ManagedProperty websocket event incompatibility HOT 2
- Protected View Exception
- Change locale is not working HOT 1
- Replace "fat" XML responses with modern JSON/RESTful responses HOT 2
- typo in webpage HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from javaserverfaces-spec.