本文整理汇总了Java中org.apache.wicket.Page.getDefaultModelObject方法的典型用法代码示例。如果您正苦于以下问题:Java Page.getDefaultModelObject方法的具体用法?Java Page.getDefaultModelObject怎么用?Java Page.getDefaultModelObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.wicket.Page
的用法示例。
在下文中一共展示了Page.getDefaultModelObject方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tryPageFactoryCache
import org.apache.wicket.Page; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private <C extends IRequestablePage> C tryPageFactoryCache(final C newPage) {
if (newPage instanceof Page) {
final Page cNewPage = (Page) newPage;
final Object modelObject = cNewPage.getDefaultModelObject();
if (modelObject != null) {
try {
final Page page = PageFactory.get().getRegisteredPage(modelObject);
if (page != null) {
return (C) page;
}
} catch (final Throwable t) {
LOG.catching(Level.WARN,
new RuntimeException(
"Not a generated model page or no suitable constructor available, falling back to default created page.",
t));
return newPage;
}
}
}
return newPage;
}
示例2: postProcessUsedPage
import org.apache.wicket.Page; //导入方法依赖的package包/类
public static <C extends IRequestablePage> C postProcessUsedPage(final Object newModelObject, final C usedPage) {
if (usedPage instanceof Page) {
final Page cUsedPage = (Page) usedPage;
if (cUsedPage.getDefaultModelObject() != null && usedPage instanceof IPageFactoryHook) {
final IPageFactoryHook hook = (IPageFactoryHook) usedPage;
hook.onPageModelRefresh(newModelObject);
}
}
return usedPage;
}
示例3: extractNewModelObject
import org.apache.wicket.Page; //导入方法依赖的package包/类
private Object extractNewModelObject(final IRequestablePage newPage) {
if (newPage instanceof Page) {
final Page cNewPage = (Page) newPage;
return cNewPage.getDefaultModelObject();
} else {
return null;
}
}
示例4: updatePage
import org.apache.wicket.Page; //导入方法依赖的package包/类
public void updatePage(final Page page) {
final Object modelObject = page.getDefaultModelObject();
if (modelObject == null) {
return;
}
// clean up existing page references if they are equal to the new one
final List<PageReferenceAndModel> pageReferences = getPageReferencesForModel(modelObject);
synchronized (pageReferences) {
for (final PageReferenceAndModel existingPageReference : pageReferences) {
try {
//see: http://mail-archives.apache.org/mod_mbox/wicket-users/201211.mbox/%[email protected].com%3E
final PageAccessSynchronizer pageAccessSynchronizer = new PageAccessSynchronizer(
org.apache.wicket.util.time.Duration.ONE_SECOND);
pageAccessSynchronizer.lockPage(existingPageReference.getPageId());
try {
final Page existingPage = existingPageReference.getPage();
//remove if page reference is lost or if its an equal model (which might be outdated)
if (existingPage == null || modelObject.equals(existingPage.getDefaultModelObject())) {
pageReferences.remove(existingPageReference);
}
} finally {
pageAccessSynchronizer.unlockPage(existingPageReference.getPageId());
}
//CHECKSTYLE:OFF
} catch (final CouldNotLockPageException e) {
//CHECKSTYLE:ON
//ignore, next call might clean up the existing references
}
}
pageReferences.add(new PageReferenceAndModel(page));
}
}
示例5: PageReferenceAndModel
import org.apache.wicket.Page; //导入方法依赖的package包/类
PageReferenceAndModel(final Page page) {
this.pageReference = page.getPageReference();
this.modelObject = page.getDefaultModelObject();
Assertions.assertThat(modelObject).isNotNull();
}