Re: problem with stateless component
Re: problem with stateless component
- Subject: Re: problem with stateless component
- From: Chuck Hill <email@hidden>
- Date: Thu, 15 May 2008 15:29:55 -0700
On May 15, 2008, at 3:24 PM, T Worman wrote:
Thanks Chuck:
Currently, here's what's in the .html and .wod files -
TSTimeComponent.html
<webobject name = "Test"></webobject>
TSTimeComponent.wod
Test : WOString {
value = timeValue;
}
timeValue is a custom class and it's toString() will just print the
time value as "hours:minutes." At this point I don't have anything
else in the wod or the html since I stripped it out for
troubleshooting. The "reason" for the error message is:
<<edu.ucla.gseis.ets.components.NonExemptTimeEditComponent name:
edu.ucla.gseis.ets.components.NonExemptTimeEditComponent
subcomponents: null >>: A stateless component can not have a
stateful child (<edu.ucla.gseis.ets.components.TSTimeComponent name:
edu.ucla.gseis.ets.components.TSTimeComponent subcomponents: null >).
TSTimeComponent.java looks like this -
public class TSTimeComponent extends WOComponent {
protected TSTime timeValue;
public TSTimeComponent(WOContext context) {
super(context);
}
public boolean isStateless() {
return true;
}
That error message says that isStateless() of TSTimeComponent is
returning false.
I think you have a build problem and an older version of the code is
running / getting loaded. Time for a clean and rebuild.
Chuck
public void reset() {
timeValue = null;
super.reset();
}
public TSTime timeValue() {
if (timeValue == null) {
timeValue = (TSTime)valueForBinding("timeValue");
}
return timeValue;
}
public void setTimeValue(TSTime newTimeValue) {
timeValue = newTimeValue;
setValueForBinding(timeValue, "timeValue");
}
//stock up with 8 hours in the list
public NSArray hourList() {
Number[] h = new Number[9];
h[0] = new Integer(0);
h[1] = new Integer(1);
h[2] = new Integer(2);
h[3] = new Integer(3);
h[4] = new Integer(4);
h[5] = new Integer(5);
h[6] = new Integer(6);
h[7] = new Integer(7);
h[8] = new Integer(8);
NSArray hourList = new NSArray(h);
return hourList;
}
// stock up with 00, 15, 30, and 45 minutes
public NSArray minuteList() {
Number[] m = new Number[4];
m[0] = new Integer(0);
m[1] = new Integer(15);
m[2] = new Integer(30);
m[3] = new Integer(45);
NSArray minuteList = new NSArray(m);
return minuteList;
}
}
Tim
On May 15, 2008, at 2:02 PM, Chuck Hill wrote:
On May 15, 2008, at 1:22 PM, T Worman wrote:
All:
I'm having a problem using a stateless component and I'm not sure
why. My app has a stateless component that has WOPopUpButtons for
selecting hours and minutes for entering time-based data. I'm
trying to abstract these WOPopUpButtons to a new stateless
component in a supporting framework. In the new component I've
overridden these:
public boolean synchronizesVariablesWithBindings() {
return false;
}
public boolean isStateless() {
return true;
}
isStateless == true implies synchronizesVariablesWithBindings ==
false, you only need to override isStateless
That is not the problem, just pointing that out.
public void reset() {
reset stuff;
super.reset();
}
The new component has one required binding for the time
value(custom class). I've inserted the new component into the old
one in place of the WOPopUpButtons that were there before. For
some reason, every time I call the page I get:
Error: java.lang.IllegalStateException: <>: A stateless component
can not have a stateful child ().
Is that the exact message?
So far I've tried dumbing the new component down to the point
where it only has the ivar to sync the required bound value and
the display of the component is just some test text. Am I going
crazy or did I forget a step somewhere in creating a stateless
component?
Probably need to see the .html and .wod to say any more. You
probably have a dynamic element that uses a component action.
Chuck
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden