本文整理匯總了Java中org.apache.wicket.Page類的典型用法代碼示例。如果您正苦於以下問題:Java Page類的具體用法?Java Page怎麽用?Java Page使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Page類屬於org.apache.wicket包,在下文中一共展示了Page類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getUrlString
import org.apache.wicket.Page; //導入依賴的package包/類
@Override
public String getUrlString(Class<? extends Page> pageClass, QueryFacetsSelection selection, SolrDocument document) {
final PageParameters params = new PageParameters();
if (selection != null) {
params.mergeWith(paramsConverter.toParameters(selection));
}
if (document != null) {
params.add(VloWebAppParameters.DOCUMENT_ID, document.getFirstValue(FacetConstants.FIELD_ID));
}
final String style = Session.get().getStyle();
if (style != null) {
params.add(VloWebAppParameters.THEME, style);
}
final CharSequence url = RequestCycle.get().urlFor(pageClass, params);
final String absoluteUrl = RequestCycle.get().getUrlRenderer().renderFullUrl(Url.parse(url));
return absoluteUrl;
}
示例2: getExceptionMapperProvider
import org.apache.wicket.Page; //導入依賴的package包/類
@Override
public final IProvider<IExceptionMapper> getExceptionMapperProvider() {
return new IProvider<IExceptionMapper>() {
@Override
public IExceptionMapper get() {
return new DefaultExceptionMapper() {
@Override
protected IRequestHandler mapExpectedExceptions(Exception e, Application application) {
Page errorPage = mapExceptions(e);
if (errorPage != null) {
return createPageRequestHandler(new PageProvider(errorPage));
} else {
return super.mapExpectedExceptions(e, application);
}
}
};
}
};
}
示例3: getMessage
import org.apache.wicket.Page; //導入依賴的package包/類
private List<ErrorItem> getMessage(Throwable cause, Page page, String errorCode) {
List<ErrorItem> items = new ArrayList<ErrorItem>();
ErrorItem item1 = new ErrorItem("Symptom", "Your operation is failed with error.");
items.add(item1);
ErrorItem item2 = new ErrorItem("Cause", cause.getMessage());
items.add(item2);
if (cause instanceof InventoryException) {
Throwable root = ExceptionUtils.getRootCause(cause);
if (root != null || root != cause) {
ErrorItem item3 = new ErrorItem("Root Cause", root.getMessage());
items.add(item3);
}
}
ErrorItem item4 = new ErrorItem("Action", "Please contact system administrator with additional information below.");
item4.addLine(errorCode);
items.add(item4);
return items;
}
示例4: getHomePage
import org.apache.wicket.Page; //導入依賴的package包/類
@Override
public Class<? extends Page> getHomePage() {
Sql2o sql2o = Spring.getBean(Sql2o.class);
try (Connection connection = sql2o.open()) {
Query query = connection.createQuery("SELECT groovy.java_class FROM setting INNER JOIN page on setting.value = page.page_id INNER JOIN groovy on page.groovy_id = groovy.groovy_id where setting.name = 'home_page'");
String javaClass = query.executeAndFetchFirst(String.class);
if (Strings.isNullOrEmpty(javaClass)) {
return DashboardPage.class;
} else {
GroovyClassLoader classLoader = Spring.getBean(GroovyClassLoader.class);
try {
return (Class<? extends Page>) classLoader.loadClass(javaClass);
} catch (ClassNotFoundException | ClassCastException e) {
return DashboardPage.class;
}
}
}
}
示例5: setUp
import org.apache.wicket.Page; //導入依賴的package包/類
public void setUp() throws Exception{
super.setUp();
Persistor.useTestEnvironment();
attributes.add(baseAttribute);
attributes.add(depAttribute);
AttributeTypeTree attributeTree = new AttributeTypeTree(attributes);
eventType = new EapEventType("TestType", attributeTree);
ArrayList<EapEventType> eventTypes = new ArrayList<>();
eventTypes.add(eventType);
EapEventType.save(eventTypes);
tester = new WicketTester(new UNICORNApplication());
tester.startPage(GeneratorPage.class);
tester.startComponentInPage(new DependenciesPanel("dependenciesPanel" , new GeneratorPage()));
// get form
List<Form> list = new ArrayList<>();
Page x = tester.getLastRenderedPage();
for (Component form : x.visitChildren(Form.class)) {
list.add((Form) form);
}
formPath = list.get(0).getPageRelativePath();
listViewPath = formPath + ":dependenciesContainer:dependenciesListview";
}
示例6: getSignInPageClass
import org.apache.wicket.Page; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Override
protected Class<? extends WebPage> getSignInPageClass() {
if(classCandidates.getSignInPageCandidates().size() <= 0){
throw new IllegalStateException("Couln't find sign in page - please annotated the sign in page with @" + WicketSignInPage.class.getName());
}
if(classCandidates.getSignInPageCandidates().size() > 1 ){
String message = "Multiple sign in pages found - please annotated exactly one class with @" + WicketSignInPage.class.getName();
message += "\n";
for(WicketClassCandidate<Page> classCandidate : classCandidates.getHomePageCandidates()) {
message += "\t" + classCandidate.getCandidate() + "\n";
}
throw new IllegalStateException(message);
}
Class<WebPage> candidateClass = classCandidates.getSignInPageCandidates().iterator().next().getCandidate();
return candidateClass;
}
示例7: EditRolePage
import org.apache.wicket.Page; //導入依賴的package包/類
public EditRolePage(PageParameters parameters) {
super(ListRolesPage.class, parameters);
long roleId = parameters.get("id").toLong(-1L);
final UIRole role = roleService.getRole(roleId);
setDefaultModel(new CompoundPropertyModel<UIRole>(role));
Form form = new Form("form"){
@Override
protected void onSubmit() {
roleService.updateRole(role);
setResponsePage(ListRolesPage.class);
}
};
add(form);
form.add(new LabelValueRow<String>("role-name", new Model<String>(role.getRoleName()), "role.create.name"));
form.add(new LabelTextFieldRow<String>(role, "principalName", "role.create.principal-name", true));
form.add(new Button("form-submit"));
form.add(new BookmarkablePageLink<Page>("form-cancel", ListRolesPage.class));
}
示例8: CloneGroupPage
import org.apache.wicket.Page; //導入依賴的package包/類
@SuppressWarnings("serial")
public CloneGroupPage(PageParameters param) {
super(ListGroupsPage.class, param);
final Long sourceId = param.get("sid").toLong();
final UIGroup sourceGroup = groupService.getGroupById(sourceId);
GroupModel groupModel = new GroupModel();
Form<GroupModel> form = new Form<GroupModel>("form", new Model<GroupModel>(groupModel)) {
@Override
protected void onSubmit() {
UICloneGroupRequest request = new UICloneGroupRequest();
request.setNewGroupName(getModelObject().getName());
request.setSourceGroupId(sourceGroup.getId());
groupService.cloneGroup(request);
setResponsePage(ListGroupsPage.class);
}
};
add(form);
form.add(new LabelValueRow<String>("source", new Model(sourceGroup.getLabel()), "group.clone.source"));
form.add(new LabelTextFieldRow<String>(groupModel, "name", "group.clone.name", true));
form.add(new BookmarkablePageLink<Page>("cancel", ListGroupsPage.class));
}
示例9: LinksTemplate
import org.apache.wicket.Page; //導入依賴的package包/類
public LinksTemplate(PageParameters parameters) {
super(parameters);
IModel<User> userModel = new GenericEntityModel<Long, User>(null);
try {
linkDescriptor(new Model<Class<Page>>(null), userModel).extract(parameters);
} catch (LinkParameterValidationException ignored) {
// Get around the parameter validation for the purpose of this test
}
add(new Label("title", getTitleModel()));
Component linkToPage1 = LinkDescriptorBuilder.toPageInstance(this).validate(LinksPage1.class).build()
.link("linkToThisPageInstanceOnlyIfPage1").hideIfInvalid();
add(linkToPage1);
add(LinkDescriptorBuilder.toPageInstance(this).validate(LinksTemplate.class).build().link("linkToThisPageInstance")
.add(Condition.componentVisible(linkToPage1).thenHide()));
add(new DynamicLinkTestPanel("linkTestPanel", userModel));
add(new DynamicImageTestPanel("imageTestPanel"));
}
示例10: EnterTopicPage
import org.apache.wicket.Page; //導入依賴的package包/類
public EnterTopicPage(PageParameters parameters) {
super(parameters);
Topic topic = new TopicModel<Topic>(parameters.getString("topicMapId"), parameters.getString("topicId")).getTopic();
Class<? extends Page> pageClass;
if (topic.isTopicType())
pageClass = InstancesPage.class;
// else if (topic.isAssociationType())
// pageClass = InstancePage.class;
// else if (topic.isOccurrenceType())
// pageClass = InstancePage.class;
// else if (topic.isNameType())
// pageClass = InstancePage.class;
// else if (topic.isRoleType())
// pageClass = InstancePage.class;
else
pageClass = InstancePage.class;
// redirect page
PageParameters params = new PageParameters();
params.add("topicMapId", topic.getTopicMap().getId());
params.add("topicId", topic.getId());
setResponsePage(pageClass, params);
setRedirect(true);
}
示例11: getValidPageInstance
import org.apache.wicket.Page; //導入依賴的package包/類
protected Page getValidPageInstance() throws LinkInvalidTargetRuntimeException {
Page pageInstance = pageInstanceModel.getObject();
if (pageInstance == null) {
throw new LinkInvalidTargetRuntimeException("The target page instance was null");
}
Class<? extends Page> validPageClass = getValidExpectedPageClass(pageInstance);
if (validPageClass == null) {
throw new LinkInvalidTargetRuntimeException("The target page instance '" + pageInstance + "' had unexpected type :"
+ " got " + pageInstance.getClass().getName() + ", "
+ "expected one of " + Joiner.on(", ").join(Collections2.transform(expectedPageClassModels, GET_NAME_FROM_CLASS_MODEL_FUNCTION)));
}
if (! bypassPermissions) {
if (!Session.get().getAuthorizationStrategy().isActionAuthorized(pageInstance, Page.RENDER)) {
throw new LinkInvalidTargetRuntimeException("The rendering of the target page instance '" + pageInstance
+ "' was not authorized.");
}
}
return pageInstance;
}
示例12: newNavbar
import org.apache.wicket.Page; //導入依賴的package包/類
protected Navbar newNavbar(final String id) {
final Navbar navbar = new Navbar(id) {
@Override
protected TransparentWebMarkupContainer newContainer(final String componentId) {
final TransparentWebMarkupContainer container = super.newCollapseContainer(componentId);
container.add(AttributeModifier.replace("class", getContainerClass()));
return container;
}
@Override
protected Class<? extends Page> getHomePage() {
return getNavbarHomePage();
}
};
navbar.setBrandName(Model.of("invesdwin-NoWicket"));
navbar.setBrandImage(DEFAULT_LOGO, Model.of("logo"));
addSignInOrSignOutPageToNavbar(navbar);
return navbar;
}
示例13: BuilderTargetFactories
import org.apache.wicket.Page; //導入依賴的package包/類
private BuilderTargetFactories(
IBuilderLinkDescriptorFactory<TEarlyTarget, TEarlyTargetDefinitionLinkDescriptor>
earlyTargetDefinitionLinkDescriptorFactory,
IModel<? extends TEarlyTarget> earlyTargetDefinitionTargetModel,
IBuilderLinkDescriptorFactory<
Class<? extends Page>, TLateTargetDefinitionPageLinkDescriptor
> lateTargetDefinitionPageLinkDescriptorFactory,
IBuilderLinkDescriptorFactory<
ResourceReference, TLateTargetDefinitionResourceLinkDescriptor
> lateTargetDefinitionResourceLinkDescriptorFactory,
IBuilderLinkDescriptorFactory<
ResourceReference, TLateTargetDefinitionImageResourceLinkDescriptor
> lateTargetDefinitionImageResourceLinkDescriptorFactory) {
super();
this.earlyTargetDefinitionLinkDescriptorFactory = earlyTargetDefinitionLinkDescriptorFactory;
this.earlyTargetDefinitionTargetModel = earlyTargetDefinitionTargetModel;
this.lateTargetDefinitionPageLinkDescriptorFactory = lateTargetDefinitionPageLinkDescriptorFactory;
this.lateTargetDefinitionResourceLinkDescriptorFactory = lateTargetDefinitionResourceLinkDescriptorFactory;
this.lateTargetDefinitionImageResourceLinkDescriptorFactory = lateTargetDefinitionImageResourceLinkDescriptorFactory;
}
示例14: SignOutPage
import org.apache.wicket.Page; //導入依賴的package包/類
@SuppressWarnings("unchecked")
public SignOutPage(final PageParameters parameters) {
add(new HeaderPanel("header"));
add(new FooterPanel("footer"));
String page = parameters.getString(REDIRECTPAGE_PARAM);
Class<? extends Page> pageClass;
if (page != null) {
try {
pageClass = (Class<? extends Page>) Class.forName(page);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
} else {
pageClass = getApplication().getHomePage();
}
getSession().invalidate();
setResponsePage(pageClass);
setRedirect(true);
}
示例15: initialiseWicketApplication
import org.apache.wicket.Page; //導入依賴的package包/類
private void initialiseWicketApplication() {
// This initialises various statically stored values that Wicket uses,
// most notably, Session and Application whose absence was causing NullPointerException during call to
// org.hippoecm.frontend.editor.validator.plugins.AbstractCmsValidator.getTranslation(java.lang.String).
new WicketTester(new WebApplication() {
public Class<? extends Page> getHomePage() {
return null;
}
});
}