Author: nbelaevski
Date: 2008-01-24 20:23:41 -0500 (Thu, 24 Jan 2008)
New Revision: 5616
Removed:
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/MessageFactory.java
Modified:
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java
Log:
http://jira.jboss.com/jira/browse/RF-2018
Deleted:
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/MessageFactory.java
===================================================================
---
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/MessageFactory.java 2008-01-25
01:20:57 UTC (rev 5615)
+++
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/MessageFactory.java 2008-01-25
01:23:41 UTC (rev 5616)
@@ -1,22 +0,0 @@
-/**
- *
- */
-package org.richfaces.component;
-
-import javax.faces.application.FacesMessage;
-import javax.faces.context.FacesContext;
-
-/**
- * @author Nick Belaevski
- * mailto:nbelaevski@exadel.com
- * created 05.11.2007
- * @since 3.2
- */
-public class MessageFactory {
-
- public static FacesMessage getMessage(FacesContext context,
- String conversionMessageId) {
- // TODO Auto-generated method stub
- return null;
- }
-}
Modified:
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java
===================================================================
---
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java 2008-01-25
01:20:57 UTC (rev 5615)
+++
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java 2008-01-25
01:23:41 UTC (rev 5616)
@@ -37,6 +37,7 @@
import org.apache.commons.collections.Predicate;
import org.apache.commons.collections.iterators.EmptyIterator;
import org.apache.commons.collections.iterators.FilterIterator;
+import org.richfaces.component.util.MessageUtil;
/**
* @author Nick Belaevski
@@ -320,9 +321,11 @@
protected void validateValue(FacesContext context, Object newValue) {
// If our value is valid, enforce the required property if present
if (isValid() && isRequired() && isEmpty(newValue)) {
- FacesMessage message =
- MessageFactory.getMessage(context, UIInput.REQUIRED_MESSAGE_ID);
+ FacesMessage message = MessageUtil.getMessage(context,
+ UIInput.REQUIRED_MESSAGE_ID,
+ new Object[] {MessageUtil.getLabel(context, this)});
message.setSeverity(FacesMessage.SEVERITY_ERROR);
+
context.addMessage(getClientId(context), message);
setValid(false);
}
@@ -431,7 +434,8 @@
FacesMessage message = null;
if (null == messageStr) {
message =
- MessageFactory.getMessage(context, UIInput.CONVERSION_MESSAGE_ID);
+ MessageUtil.getMessage(context, UIInput.CONVERSION_MESSAGE_ID,
+ new Object[] {MessageUtil.getLabel(context, this)});
}
else {
message = new FacesMessage(messageStr);
@@ -441,20 +445,23 @@
setValid(false);
}
catch (FacesException e) {
- FacesMessage message =
- MessageFactory.getMessage(context, UIInput.CONVERSION_MESSAGE_ID);
+ FacesMessage message =
+ MessageUtil.getMessage(context, UIInput.CONVERSION_MESSAGE_ID,
+ new Object[] {MessageUtil.getLabel(context, this)});
message.setSeverity(FacesMessage.SEVERITY_ERROR);
context.addMessage(getClientId(context), message);
setValid(false);
} catch (IllegalArgumentException e) {
- FacesMessage message =
- MessageFactory.getMessage(context, UIInput.CONVERSION_MESSAGE_ID);
+ FacesMessage message =
+ MessageUtil.getMessage(context, UIInput.CONVERSION_MESSAGE_ID,
+ new Object[] {MessageUtil.getLabel(context, this)});
message.setSeverity(FacesMessage.SEVERITY_ERROR);
context.addMessage(getClientId(context), message);
setValid(false);
} catch (Exception e) {
FacesMessage message =
- MessageFactory.getMessage(context, UIInput.CONVERSION_MESSAGE_ID);
+ MessageUtil.getMessage(context, UIInput.CONVERSION_MESSAGE_ID,
+ new Object[] {MessageUtil.getLabel(context, this)});
message.setSeverity(FacesMessage.SEVERITY_ERROR);
context.addMessage(getClientId(context), message);
setValid(false);
@@ -488,8 +495,8 @@
ConverterException ce, Object value) {
FacesMessage message = ce.getFacesMessage();
if (message == null) {
- message = MessageFactory.getMessage(context,
- UIInput.CONVERSION_MESSAGE_ID);
+ message = MessageUtil.getMessage(context, UIInput.CONVERSION_MESSAGE_ID,
+ new Object[] {MessageUtil.getLabel(context, this)});
if (message.getDetail() == null) {
message.setDetail(ce.getMessage());
}