use of com.willshex.blogwt.shared.page.PageType in project blogwt by billy1380.
the class NavigationController method addStack.
private void addStack(Stack value) {
String page = value.getPage();
PageType stackPage = PageType.fromString(page);
if (stackPage == null) {
stackPage = PageType.PageDetailPageType;
}
final Stack previous = stack;
stack = value;
attachPage(stackPage, new NavigationChangedEvent(previous, stack));
}
use of com.willshex.blogwt.shared.page.PageType in project blogwt by billy1380.
the class NavigationController method addPage.
/**
* @param value
*/
public void addPage(String value) {
value = (value == null || value.trim().length() == 0 || value.replace("!", "").trim().length() == 0) ? PageController.get().homePageTargetHistoryToken() : value;
Stack s = Stack.parse(value);
PageType p = s == null ? null : PageType.fromString(s.getPage());
if (PropertyController.get().blog() == null && p != PageType.SetupBlogPageType) {
PageTypeHelper.show(PageType.SetupBlogPageType);
} else {
if (PropertyController.get().blog() != null && p == PageType.SetupBlogPageType) {
PageTypeHelper.show(PageController.get().homePageTargetHistoryToken());
} else if (p != null && p.requiresLogin() && !SessionController.get().isValidSession()) {
SessionController.get().logout(PageType.LoginPageType, s.asNextParameter());
} else if (p != null && !((p.requiresLogin() && !SessionController.get().isAuthorised(p)) || PropertyController.get().isConfigured(p == null ? null : JsonableHelper.values(p.getRequiredProperties())))) {
lost();
} else {
if (intended != null && intended.equals(s.toString())) {
intended = null;
}
addStack(s);
}
}
}
use of com.willshex.blogwt.shared.page.PageType in project blogwt by billy1380.
the class PageMarkupFactory method createFromStack.
public static PageMarkup createFromStack(Stack stack) {
PageType pageType = PageType.fromString(stack.getPage());
pageType = (pageType == null ? PageType.PageDetailPageType : pageType);
PageMarkup pageMarkup = null;
switch(pageType) {
case PageDetailPageType:
pageMarkup = new StaticPage(stack);
break;
case PostsPageType:
pageMarkup = new StaticPosts(stack);
break;
case PostDetailPageType:
pageMarkup = new StaticPost(stack);
break;
case TagPostsPageType:
pageMarkup = new StaticTag(stack);
break;
default:
break;
}
return pageMarkup != null && pageMarkup.canCreate() ? pageMarkup : POSTS;
}
Aggregations