SWF-483
Added extension to the ViewFacotryCreator interface, createViewIdByConvention, to obtain the default view id for a view state id
This commit is contained in:
@@ -35,4 +35,10 @@ public interface ViewFactoryCreator {
|
||||
*/
|
||||
public ViewFactory createViewFactory(Expression viewId, ResourceLoader viewResourceLoader);
|
||||
|
||||
/**
|
||||
* Create the default id of the view to render in the provided view state by convention.
|
||||
* @param viewStateId the view state id
|
||||
* @return the default view id
|
||||
*/
|
||||
public String createViewIdByConvention(String viewStateId);
|
||||
}
|
||||
|
||||
@@ -593,7 +593,7 @@ public class XmlFlowBuilder extends AbstractFlowBuilder implements ResourceHolde
|
||||
if (endState) {
|
||||
return null;
|
||||
} else {
|
||||
encodedView = createViewId(parseId(element));
|
||||
encodedView = getLocalContext().getViewFactoryCreator().createViewIdByConvention(parseId(element));
|
||||
Expression viewName = getExpressionParser().parseExpression(encodedView,
|
||||
new ParserContextImpl().eval(RequestContext.class).expect(String.class));
|
||||
return getLocalContext().getViewFactoryCreator().createViewFactory(viewName,
|
||||
@@ -620,11 +620,6 @@ public class XmlFlowBuilder extends AbstractFlowBuilder implements ResourceHolde
|
||||
}
|
||||
}
|
||||
|
||||
// TODO - make configurable
|
||||
private String createViewId(String viewStateId) {
|
||||
return viewStateId + ".xhtml";
|
||||
}
|
||||
|
||||
private Action[] parseRenderActions(Element element) {
|
||||
Element renderActionsElement = DomUtils.getChildElementByTagName(element, "on-render");
|
||||
if (renderActionsElement != null) {
|
||||
|
||||
@@ -62,6 +62,11 @@ public class MvcViewFactoryCreator implements ViewFactoryCreator, ApplicationCon
|
||||
}
|
||||
}
|
||||
|
||||
public String createViewIdByConvention(String viewStateId) {
|
||||
// TODO - make configurable
|
||||
return viewStateId + ".jsp";
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the view resolvers that will be used to resolve views selected by flows. If multiple resolvers are to be
|
||||
* used, the resolvers should be ordered in the manner they should be applied.
|
||||
|
||||
@@ -40,6 +40,10 @@ class MockViewFactoryCreator implements ViewFactoryCreator {
|
||||
return new MockViewFactory(viewId);
|
||||
}
|
||||
|
||||
public String createViewIdByConvention(String viewStateId) {
|
||||
return viewStateId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Mock View implementation that simply holds the evaluated view identifier.
|
||||
* @author Keith Donald
|
||||
|
||||
Reference in New Issue
Block a user