vgritsenko 2004/02/28 21:29:41
Modified: src/blocks/woody/java/org/apache/cocoon/woody/formmodel
AbstractWidgetDefinitionBuilder.java
Log:
exception messages, formatting
Revision Changes Path
1.12 +17 -14
cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/AbstractWidgetDefinitionBuilder.java
Index: AbstractWidgetDefinitionBuilder.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/AbstractWidgetDefinitionBuilder.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- AbstractWidgetDefinitionBuilder.java 11 Feb 2004 10:43:30 -0000
1.11
+++ AbstractWidgetDefinitionBuilder.java 29 Feb 2004 05:29:41 -0000
1.12
@@ -77,7 +77,7 @@
/**
* Abstract base class for WidgetDefinitionBuilders. Provides functionality
* common to many implementations.
- *
+ *
* @version $Id$
*/
public abstract class AbstractWidgetDefinitionBuilder implements
WidgetDefinitionBuilder, Serviceable, Disposable {
@@ -102,7 +102,8 @@
protected void setId(Element widgetElement, AbstractWidgetDefinition
widgetDefinition) throws Exception {
String id = DomHelper.getAttribute(widgetElement, "id");
if (id.length() < 1) {
- throw new Exception("Missing id attribute on element \"" +
widgetElement.getTagName() + "\" at " + DomHelper.getLocation(widgetElement));
+ throw new Exception("Missing id attribute on element '" +
widgetElement.getTagName() + "' at " +
+ DomHelper.getLocation(widgetElement));
}
widgetDefinition.setId(id);
}
@@ -113,7 +114,8 @@
try {
builder =
(WidgetDefinitionBuilder)widgetDefinitionBuilderSelector.select(widgetName);
} catch (ServiceException e) {
- throw new CascadingException("Unknown kind of widget \"" +
widgetName + "\" specified at " + DomHelper.getLocation(widgetDefinition), e);
+ throw new CascadingException("Unknown kind of widget '" +
widgetName + "' at " +
+
DomHelper.getLocation(widgetDefinition), e);
}
return builder.buildWidgetDefinition(widgetDefinition);
}
@@ -131,10 +133,10 @@
}
}
}
-
+
return result == null ? Collections.EMPTY_LIST : result;
}
-
+
protected void setDisplayData(Element widgetElement,
AbstractWidgetDefinition widgetDefinition) throws Exception {
final String[] names = {"label", "help", "hint"};
Map displayData = new HashMap(names.length);
@@ -144,15 +146,15 @@
if (dataElement != null) {
data = DomHelper.compileElementContent(dataElement);
}
-
- // Note: we put also null values in the may in order to test
their existence
- // (see AbstractWidgetDefinition.generateDisplayData)
+
+ // NOTE: We put also null values in the may in order to test
their existence
+ // (see AbstractWidgetDefinition.generateDisplayData)
displayData.put(names[i], data);
}
-
+
widgetDefinition.setDisplayData(displayData);
}
-
+
protected void setValidators(Element widgetElement,
AbstractWidgetDefinition widgetDefinition) throws Exception {
Element validatorElement = DomHelper.getChildElement(widgetElement,
Constants.WD_NS, "validation");
if (validatorElement != null) {
@@ -165,15 +167,16 @@
try {
builder =
(WidgetValidatorBuilder)this.widgetValidatorBuilderSelector.select(name);
} catch(ServiceException e) {
- throw new CascadingException("Unknow kind of
validator '" + name + "' at " + DomHelper.getLocation(element), e);
+ throw new CascadingException("Unknow kind of
validator '" + name + "' at " +
+
DomHelper.getLocation(element), e);
}
-
+
widgetDefinition.addValidator(builder.build(element,
widgetDefinition));
}
}
}
}
-
+
public void dispose() {
serviceManager.release(widgetDefinitionBuilderSelector);
serviceManager.release(datatypeManager);