Example usage for org.apache.wicket IPageFactory newPage

List of usage examples for org.apache.wicket IPageFactory newPage

Introduction

In this page you can find the example usage for org.apache.wicket IPageFactory newPage.

Prototype

<C extends IRequestablePage> C newPage(final Class<C> pageClass, final PageParameters parameters);

Source Link

Document

Creates a new Page, passing PageParameters to the Page constructor if such a constructor exists.

Usage

From source file:com.jolira.wicket.guicier.GuicierPageFactoryProxy.java

License:Open Source License

/**
 * @see IPageFactory#newPage(Class, PageParameters)
 *///from  ww w  .  j  a va  2 s  . c o m
@Override
public <C extends IRequestablePage> IRequestablePage newPage(final Class<C> pageClass,
        final PageParameters parameters) {
    final Injector i = getInjector();
    final IPageFactory factory = i.getInstance(GuicierPageFactory.class);

    return factory.newPage(pageClass, parameters);
}

From source file:org.apache.isis.viewer.wicket.viewer.integration.wicket.WebRequestCycleForIsis.java

License:Apache License

/**
 * Tries to instantiate the configured {@link PageType#SIGN_IN signin page} with the given exception model
 *
 * @param exceptionModel A model bringing the information about the occurred problem
 * @return An instance of the configured signin page
 *///from  w  w  w  .  ja  v  a 2s  . c o m
private IRequestablePage newSignInPage(final ExceptionModel exceptionModel) {
    Class<? extends Page> signInPageClass = null;
    if (pageClassRegistry != null) {
        signInPageClass = pageClassRegistry.getPageClass(PageType.SIGN_IN);
    }
    if (signInPageClass == null) {
        signInPageClass = WicketSignInPage.class;
    }
    final PageParameters parameters = new PageParameters();
    Page signInPage;
    try {
        Constructor<? extends Page> constructor = signInPageClass.getConstructor(PageParameters.class,
                ExceptionModel.class);
        signInPage = constructor.newInstance(parameters, exceptionModel);
    } catch (Exception ex) {
        try {
            IPageFactory pageFactory = Application.get().getPageFactory();
            signInPage = pageFactory.newPage(signInPageClass, parameters);
        } catch (Exception x) {
            throw new WicketRuntimeException("Cannot instantiate the configured sign in page", x);
        }
    }
    return signInPage;
}