if (forward != null)
{
final Collection forwardParameters = forward.getForwardParameters();
for (final Iterator parameterIterator = forwardParameters.iterator(); parameterIterator.hasNext();)
{
final ModelElementFacade forwardParameter = (ModelElementFacade)parameterIterator.next();
formFieldMap.put(
forwardParameter.getName(),
forwardParameter);
}
}
}
// add page variables for all pages/final-states targetted
// also add the fields of the target page's actions (for preloading)
final Collection forwards = this.getActionForwards();
for (final Iterator iterator = forwards.iterator(); iterator.hasNext();)
{
final FrontEndForward forward = (FrontEndForward)iterator.next();
final StateVertexFacade target = forward.getTarget();
if (target instanceof FrontEndView)
{
final FrontEndView view = (FrontEndView)target;
final Collection viewVariables = view.getVariables();
for (final Iterator pageVariableIterator = viewVariables.iterator(); pageVariableIterator.hasNext();)
{
final ModelElementFacade facade = (ModelElementFacade)pageVariableIterator.next();
formFieldMap.put(
facade.getName(),
facade);
}
final Collection allActionParameters = view.getAllFormFields();
for (final Iterator actionParameterIterator = allActionParameters.iterator();
actionParameterIterator.hasNext();)
{
// - don't allow existing parameters that are tables be overwritten (since they take
// precedence
final Object parameter = actionParameterIterator.next();
if (parameter instanceof FrontEndParameter)
{
FrontEndParameter variable = (FrontEndParameter)parameter;
final String name = variable.getName();
final Object existingParameter = formFieldMap.get(name);
if (existingParameter instanceof FrontEndParameter)
{
final FrontEndParameter existingVariable = (FrontEndParameter)existingParameter;
if (existingVariable != null)
{
if (existingVariable.isTable())
{
variable = existingVariable;
}
}
}
formFieldMap.put(
name,
variable);
}
}
}
else if (target instanceof FrontEndFinalState)
{
// only add these if there is no parameter recorded yet with the same name
final Collection forwardParameters = forward.getForwardParameters();
for (final Iterator parameterIterator = forwardParameters.iterator(); parameterIterator.hasNext();)
{
final ModelElementFacade facade = (ModelElementFacade)parameterIterator.next();
if (!formFieldMap.containsKey(facade.getName()))
{
formFieldMap.put(
facade.getName(),
facade);
}
}
}
}