本文整理汇总了Java中org.apache.wicket.PageReference.getPage方法的典型用法代码示例。如果您正苦于以下问题:Java PageReference.getPage方法的具体用法?Java PageReference.getPage怎么用?Java PageReference.getPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.wicket.PageReference
的用法示例。
在下文中一共展示了PageReference.getPage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: storePageForView
import org.apache.wicket.PageReference; //导入方法依赖的package包/类
/**
* Legt zum HashCode der View die PageReference der Page in der Session ab.
* Falls es bereits eine PageReference zu der View in der Session gibt, wird
* diese entfernt
*
* @param page
* - the Page (PageReference) to store
*/
public void storePageForView(DMDWebPage page) {
// Remove other PageReferences for the same Object
List<PageReference> pageReferences = NocketSession.get().getPageReferences(view.hashCode());
//use copy to iterate to prevent ConcurrentModificationException
List<PageReference> pageReferencesCopy = new ArrayList<PageReference>(pageReferences);
for (PageReference pageReference : pageReferencesCopy) {
try {
//try to lock failing fast: http://mail-archives.apache.org/mod_mbox/wicket-users/201211.mbox/%[email protected].com%3E
PageAccessSynchronizer synchronizer = new PageAccessSynchronizer(Duration.ONE_SECOND);
synchronizer.lockPage(pageReference.getPageId());
if (pageReference.getPage() != null && pageReference.getPage().getDefaultModel() != null
&& view.equals(page.getDefaultModel().getObject())) {
pageReferences.remove(pageReference);
// We have stored only one PageReference for this view, so we can stop here
break;
}
//this should behave like a ReentrantLock
synchronizer.unlockPage(pageReference.getPageId());
} catch (CouldNotLockPageException e) {
//if lock not possible, ignore this page, maybe the next call will remove this reference
}
}
pageReferences.add(page.getPageReference());
}
示例2: theSameForPage
import org.apache.wicket.PageReference; //导入方法依赖的package包/类
public static <T extends Component> T theSameForPage(T object, PageReference containingPageReference) {
Page containingPage = containingPageReference.getPage();
if (containingPage == null) {
return object;
}
String path = object.getPageRelativePath();
T retval = (T) containingPage.get(path);
if (retval == null) {
return object;
// throw new IllegalStateException("There is no component like " +
// object + " (path '" + path + "') on " + containingPage);
}
return retval;
}
示例3: Details
import org.apache.wicket.PageReference; //导入方法依赖的package包/类
public Details(
final AnyWrapper<T> wrapper,
final boolean templateMode,
final boolean includeStatusPanel,
final PageReference pageRef) {
this.pageRef = pageRef;
final T inner = wrapper.getInnerObject();
if (templateMode) {
realm = new AjaxTextFieldPanel(
"destinationRealm", "destinationRealm", new PropertyModel<>(inner, "realm"), false);
AjaxTextFieldPanel.class.cast(realm).enableJexlHelp();
} else {
final List<RealmTO> realms = pageRef.getPage() instanceof Realms
? getRealmsFromLinks(Realms.class.cast(pageRef.getPage()).getRealmChoicePanel().getLinks())
: new RealmRestClient().list();
realm = new AjaxDropDownChoicePanel<>(
"destinationRealm", "destinationRealm", new PropertyModel<>(inner, "realm"), false);
((AjaxDropDownChoicePanel<String>) realm).setChoices(
realms.stream().map(RealmTO::getFullPath).collect(Collectors.toList()));
}
add(realm);
add(getGeneralStatusInformation("generalStatusInformation", inner).
setEnabled(includeStatusPanel).setVisible(includeStatusPanel).setRenderBodyOnly(true));
}
示例4: getPageInstance
import org.apache.wicket.PageReference; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public DMDWebPage getPageInstance() {
DMDWebPage instance = null;
List<PageReference> pageReferences = NocketSession.get().getPageReferences(view.hashCode());
// Iteriert über alle PageReferences, die zu dem HashCode der View hinterlegt sind.
// Dies ist im Normalfall genau eine PageReference, deshalb ist die Iteration hierüber nicht teuer
for (PageReference pageReference : pageReferences) {
try {
//try to lock failing fast: http://mail-archives.apache.org/mod_mbox/wicket-users/201211.mbox/%3CCANg[email protected]%3E
PageAccessSynchronizer synchronizer = new PageAccessSynchronizer(Duration.ONE_SECOND);
synchronizer.lockPage(pageReference.getPageId());
Page page = pageReference.getPage();
if (view.equals(page.getDefaultModel().getObject())) {
instance = (DMDWebPage) page;
//Das Modelobject muss ein sinnvolles Equals implementieren, dennoch kann sich innerhalb des
//View-Objektes etwas gendert haben, deshalb muss hier Das ModelObject neu gesetzt werden
instance.modelChanging();
((IModel<Object>) instance.getDefaultModel()).setObject(view);
instance.modelChanged();
break;
}
synchronizer.unlockPage(pageReference.getPageId());
} catch (CouldNotLockPageException e) {
//if lock not possible, ignore this page and worst case create a new one
}
}
if (instance == null) {
instance = newPageInstance();
}
storePageForView(instance);
return instance;
}