本文整理匯總了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();
}