* Generate sub-definition initializer fragments from each of our state-
* specific property values.
*/
public Iterator<CodeFragmentList> getSubDefinitionIterators()
{
IteratorList iterList = new IteratorList();
Set<String> states = info.getStateNames();
for (Iterator<String> iter = states.iterator(); iter.hasNext(); )
{
State state = (State) stateByName(iter.next());
if (state != null)
{
// State event initializers
for (Iterator<Initializer> eventList = state.getEvents(); eventList.hasNext(); )
{
EventInitializer ei = (EventInitializer) eventList.next();
iterList.add(ei.getDefinitionsIterator());
}
// Override value initializers
for (Iterator<StatesModel.Override> items = state.overrides.iterator(); items.hasNext(); )
{
StatesModel.Override override = items.next();
if (override instanceof SetPropertyOverride)
{
ValueInitializer initializer = ((SetPropertyOverride)override).value;
Object rvalue = initializer.getValue();
if (rvalue instanceof Model && !initializedModels.contains(rvalue))
{
iterList.add(initializer.getDefinitionsIterator());
initializedModels.add(rvalue);
}
}
}
}
}
return iterList.toIterator();
}