mpo 2004/04/21 14:10:05
Modified: src/blocks/forms/java/org/apache/cocoon/forms/formmodel
AbstractWidget.java
Log:
Making the widget-instance parent a write-once property.
Revision Changes Path
1.9 +6 -4
cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java
Index: AbstractWidget.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- AbstractWidget.java 21 Apr 2004 13:33:37 -0000 1.8
+++ AbstractWidget.java 21 Apr 2004 21:10:05 -0000 1.9
@@ -99,11 +99,13 @@
/**
* Sets the parent-widget of this widget.
- * @param widget
+ * This is a write-once property.
+ *
+ * @param widget the parent-widget of this one.
+ * @throws IllegalStateException when the parent had already been set.
*/
public void setParent(Widget widget) {
- //TODO: check if we should not make this writable only once
- // (i.e. allow set only if this.parent == null)
+ if (this.parent != null) throw new IllegalStateException("The parent
of widget " + getFullyQualifiedId() + " should only be set once.");
this.parent = widget;
}