Example usage for org.apache.wicket Application getRootRequestMapperAsCompound

List of usage examples for org.apache.wicket Application getRootRequestMapperAsCompound

Introduction

In this page you can find the example usage for org.apache.wicket Application getRootRequestMapperAsCompound.

Prototype

public final ICompoundRequestMapper getRootRequestMapperAsCompound() 

Source Link

Document

Converts the root mapper to a ICompoundRequestMapper if necessary and returns the converted instance.

Usage

From source file:jp.xet.uncommons.wicket.fixedurl.FixedUrlHomePageMapper.java

License:Apache License

/**
 * TODO for daisuke// w w w  .ja  v a 2 s . c  om
 * 
 * @param application {@link Application}
 * @throws NullPointerException ?{@code null}???
 * @since 1.2
 */
public static void replaceHomePageMapper(final Application application) {
    Args.notNull(application, "application");
    ICompoundRequestMapper mappers = application.getRootRequestMapperAsCompound();
    IRequestMapper homePageMapper = null;
    for (IRequestMapper mapper : mappers) {
        if (mapper instanceof HomePageMapper) {
            homePageMapper = mapper;
            break;
        }
    }
    if (homePageMapper != null) {
        mappers.remove(homePageMapper);
    }
    mappers.add(new FixedUrlHomePageMapper(new ClassProvider<Page>(null) {

        @Override
        public Class<Page> get() {
            @SuppressWarnings("unchecked")
            Class<Page> homePage = (Class<Page>) application.getHomePage();
            return homePage;
        }
    }));
}

From source file:org.xaloon.wicket.component.mount.AbstractPageMountScannerListener.java

License:Apache License

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override//from w  w w. j a v a  2  s.c o  m
public void onMount(List<Class<?>> classesToMount) {
    Application application = Application.get();
    for (Class<?> pageClass : classesToMount) {
        application.getRootRequestMapperAsCompound().add(getMountedMapper((Class) pageClass));
    }
}

From source file:org.xaloon.wicket.component.mount.AbstractPageMountScannerListener.java

License:Apache License

@Override
public void onMount(Map<String, Class<?>> mountPages) {
    Application application = Application.get();
    for (Map.Entry<String, Class<?>> item : mountPages.entrySet()) {
        application.getRootRequestMapperAsCompound().add(getMountedMapper(item));
    }/*from www .  j ava 2s . c o  m*/
}