Hello,
I have been pulling GWT 1.5 into our code (to replace 1.4), and I
have hit an error that I'm not sure how to handle. It is related to
some code in gwt-validator...
----------------------------------------
[java] Scanning for additional dependencies: file:/C:/Data/Dev/
EclipseWorkspace/com.elektratech.nile.web.commons/gwt/gwt/validator/
client/check/BaseCheck.java
[java] Computing all possible rebind results for
'gwt.validator.client.message.IssueMessages'
[java] Rebinding gwt.validator.client.message.IssueMessages
[java] Invoking <generate-with
class='com.google.gwt.i18n.rebind.LocalizableGenerator'/>
[java] Processing interface
gwt.validator.client.message.IssueMessages
[java] Generating method body for
stringLengthTooLong()
[java] [ERROR] Required argument 1 not present:
{0}''s length is too long (max {3} characters).
[java] [ERROR] Errors in 'file:/C:/Data/Dev/EclipseWorkspace/
com.elektratech.nile.web.commons/gwt/gwt/validator/client/check/
BaseCheck.java'
[java] [ERROR] Line 150: Failed to resolve
'gwt.validator.client.message.IssueMessages' via deferred binding
[java] [ERROR] Cannot proceed due to previous errors
[java] [ERROR] Build failed
----------------------------------------
I know that gwt-validator is no longer supported and so I suppose
there's no reason to expect that it will be made 1.5-compatible. So I
got the latest source off the trunk, and I'll be able to make whatever
changes are needed. Here is the BaseCheck class from gwt-validator
source that the error refers to...
----------------------------------------
/**
* gwt-validator
*
* Copyright (C) 2006 Nikolaus Rumm, Christian Simonutti
*
* This library 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 library 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 library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
package gwt.validator.client.check;
import gwt.validator.client.message.IssueMessages;
import java.util.List;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.Label;
/**
* Base class for all validators.
*
* @author <a href="mailto:
nikola...@gmail.com">Nikolaus Rumm</a>
*
*/
public abstract class BaseCheck implements Check {
/**
* The validation issues that were found by this check.
*/
private List issues;
/**
* The label widget that holds the property's name
*/
private Label propertyNameLabel;
/**
* The property's name
*/
private String propertyName;
/**
* Constructor
*
* @param aPropertyNameLabel
* The label that holds the property's name
*/
public BaseCheck(Label aPropertyNameLabel) {
super();
checkNotNull(aPropertyNameLabel);
propertyNameLabel = aPropertyNameLabel;
}
/**
* Constructor
*
* @param aPropertyName
* The property's names
*/
public BaseCheck(String aPropertyName) {
super();
checkNotNull(aPropertyName);
propertyName = aPropertyName;
}
/**
* Performs the validation.
*
* @return The list of validation issues. An empty list means that
there
* were no issues.
*/
public List validate() {
return this.validateImpl();
}
/**
* Definition of the actual validation method.
*
* Overwrite this with your specific implementation.
*
* @return The list of validation issues. An empty list means that
there
* were no issues.
*/
protected abstract List validateImpl();
/**
* Convenience method for checking that an argument is not null.
*
* @param aParam
* The argument
*/
protected void checkNotNull(Object aParam) {
if (aParam == null) {
throw new IllegalArgumentException("The argument must not be
null.");
}
}
/**
* Convenience mtehod for checking that an int argument is greater or
equal
* than the given threshold.
*
* @param aParam
* The argument
* @param aMinValue
* The minimum valid value of aParam
*/
protected void checkMinValue(int aParam, int aMinValue) {
if (aParam < aMinValue) {
throw new IllegalArgumentException(
"The argument must be greater or equal than " + aMinValue
+ ".");
}
}
public Label getPropertyNameLabel() {
return propertyNameLabel;
}
protected String getPropertyName() {
String res = null;
if (this.propertyName != null) {
res = this.propertyName;
} else if (this.propertyNameLabel != null) {
res = this.propertyNameLabel.getText();
} else {
res = "field";
}
return res;
}
/**
* Constructs a new validation issue mesage factory.
*
* TODO: This might be inefficient, but until now I didn't find a way
to
* efficiently reuse it (static final didn't work).
*
* @return
*/
protected IssueMessages getIssueMessageFactory() {
return (IssueMessages) GWT.create(IssueMessages.class);
}
}
----------------------------------------
...and here is the IssueMessages class...
----------------------------------------
/**
* gwt-validator
*
* Copyright (C) 2006 Nikolaus Rumm, Christian Simonutti
*
* This library 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 library 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 library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
package gwt.validator.client.message;
import com.google.gwt.i18n.client.Messages;
/**
* The <code>IssuesMessages</code> interface defines the contract
between the
* validation framework and GWT to generate a runtime delegator for
accessing
* the error message resources.
*
* @author <a href="mailto:
nikola...@gmail.com">Nikolaus Rumm</a>
*
*/
public interface IssueMessages extends Messages {
/**
* @param aPropertyName
* The property's name
* @return The localized message
*/
String mandatoryTextIsEmpty(String aPropertyName);
/**
* @param aPropertyName
* The property's name
* @param aPropertyValue
* The invalid string
* @param aLength
* The actual length of the invalid string
* @param aMinLength
* The minimum valid length of the string
* @return The localized message
*/
String stringLengthTooShort(String aPropertyName, String
aPropertyValue,
int aActualLength, int aMinLength);
/**
* @param aPropertyName
* The property's name
* @param aPropertyValue
* The invalid string
* @param aLength
* The actual length of the invalid string
* @param aMaxLength
* The maximum valid length of the string
* @return The localized message
*/
String stringLengthTooLong(String aPropertyName, String
aPropertyValue,
int aActualLength, int aMaxLength);
/**
* @param aPropertyName
* The property's name
* @return The localized message
*/
String stringDoesNotMatchPattern(String aPropertyName);
/**
* @param aPropertyName
* The property's name
* @return The localized message
*/
String stringDoesNotMatchEmailAddressPattern(String aPropertyName);
/**
* @param aPropertyName
* The property's name
* @return The localized message
*/
String stringDoesNotMatchDatePattern(String aPropertyName);
/**
* @param aPropertyName
* The property name
* @param aPropertyNameEqual
* The name of the property whose data must be equal
* @return
*/
String stringNotEqual(String aPropertyName, String
aPropertyNameEqual);
/**
* @param aPropertyName
* The property's name
* @return The localized message
*/
String integerWrongSyntax(String aPropertyName);
/**
* @param aPropertyName
* The property's name
* @param aValue
* The property's value
* @return
*/
String integerTooSmall(String aPropertyName, int aValue);
/**
* @param aPropertyName
* The property's name
* @param aValue
* The property's value
* @return
*/
String integerTooBig(String aPropertyName, int aValue);
}
----------------------------------------
Thanks in advance for any help that can be provided. I can post
other source code from gwt-validator, if needed.
-Monkey Mike