Example usage for org.apache.wicket Page getPageClass

List of usage examples for org.apache.wicket Page getPageClass

Introduction

In this page you can find the example usage for org.apache.wicket Page getPageClass.

Prototype

public final Class<? extends Page> getPageClass() 

Source Link

Usage

From source file:de.alpharogroup.wicket.base.util.url.WicketUrlExtensions.java

License:Apache License

/**
 * Gets the base url from the given WebPage.
 * // ww  w  .  j av a2s.  c  om
 * @param page
 *            the page
 * @return the base url
 */
public static Url getBaseUrl(final Page page) {
    return getBaseUrl(page.getPageClass());
}

From source file:de.alpharogroup.wicket.base.util.url.WicketUrlExtensions.java

License:Apache License

/**
 * Gets the page url as Url object from the given WebPage.
 * // w w w.j a  va  2s  . c  o m
 * @param page
 *            the page
 * @return the page url
 */
public static Url getPageUrl(final Page page) {
    return getPageUrl(page.getPageClass());
}

From source file:de.alpharogroup.wicket.base.util.url.WicketUrlExtensions.java

License:Apache License

/**
 * Gets the page url./*from w  w  w . j  a  va2 s. c  om*/
 *
 * @param page
 *            the page
 * @param parameters
 *            the parameters
 * @return the page url
 */
public static Url getPageUrl(final Page page, final PageParameters parameters) {
    return getPageUrl(page.getPageClass(), parameters);
}

From source file:de.alpharogroup.wicket.base.util.url.WicketUrlExtensions.java

License:Apache License

/**
 * Gets the url as string from the given WebPage.
 * //from  w w  w  .  j a va  2 s. c o m
 * @param page
 *            the page
 * @return the url as string
 */
public static String getUrlAsString(final Page page) {
    return getUrlAsString(page.getPageClass());
}

From source file:guru.mmp.application.web.template.navigation.NavigationState.java

License:Apache License

/**
 * Returns <code>true</code> if the specified page is the last page that was accessed in the
 * navigation hierarchy or <code>false</code> otherwise.
 *
 * @param page the page//from  w w  w.ja v a 2  s. c  o  m
 *
 * @return <code>true</code> if the specified page is the last page that was accessed in the
 * navigation hierarchy or <code>false</code> otherwise
 */
public boolean isLastPageAccessedInNavigationHierarchy(Page page) {
    // If we do not have a last page that was accessed in the navigation hierarchy
    if (lastPageAccessedInNavigationHierarchyClass == null) {
        return false;
    }

    /*
     * If the page classes don't match then this can't be the last page that was accessed in
     * the navigation hierarchy.
     */
    if (lastPageAccessedInNavigationHierarchyClass != page.getPageClass()) {
        return false;
    }

    /*
     * If the page does not have parameters then this must be the last page that was accessed in
     * the navigation hierarchy.
     */
    if (page.getPageParameters().isEmpty()) {
        return true;
    }

    /*
     * If we get here we check the page parameters since we might be dealing with the same
     * type of page but it might have different parameters.
     */
    PageParameters pageParameters = page.getPageParameters();

    for (String namedKey : pageParameters.getNamedKeys()) {
        List<StringValue> pageParameterValues = pageParameters.getValues(namedKey);

        List<StringValue> lastPageAccessedInNavigationHierarchyParameterValues = lastPageAccessedInNavigationHierarchyParameters
                .getValues(namedKey);

        if (pageParameterValues.size() != lastPageAccessedInNavigationHierarchyParameterValues.size()) {
            return false;
        }

        for (int i = 0; i < pageParameterValues.size(); i++) {
            if (!pageParameterValues.get(i).toString()
                    .equals(lastPageAccessedInNavigationHierarchyParameterValues.get(i).toString())) {
                return false;
            }
        }
    }

    return true;
}

From source file:guru.mmp.application.web.template.navigation.NavigationState.java

License:Apache License

/**
 * Set the last page that was accessed that was part of the navigation hierarchy.
 *
 * @param page the last page that was accessed that was part of the navigation hierarchy
 *//* w ww . j a  v a  2 s. c o  m*/
public void setLastPageAccessedInNavigationHierarchy(Page page) {
    lastPageAccessedInNavigationHierarchyClass = page.getPageClass();

    lastPageAccessedInNavigationHierarchyParameters = page.getPageParameters();
}

From source file:org.devgateway.eudevfin.dim.NavbarInitializer.java

License:Open Source License

@WicketNavbarComponentInitializer(position = Navbar.ComponentPosition.RIGHT, disabled = true, order = 97)
public static Component newThemesNavbarButton(final Page page) {
    return new NavbarDropDownButton(Model.of("Themes")) {
        @Override/*from ww  w .j a  v  a2s .  c o  m*/
        public boolean isActive(final Component item) {
            return false;
        }

        @SuppressWarnings("Convert2Diamond")
        @Override
        protected List<AbstractLink> newSubMenuButtons(final String buttonMarkupId) {
            final List<AbstractLink> subMenu = new ArrayList<AbstractLink>();
            subMenu.add(new MenuHeader(Model.of("all available themes:")));
            subMenu.add(new MenuDivider());

            final IBootstrapSettings settings = Bootstrap.getSettings(this.getApplication());
            final List<ITheme> themes = settings.getThemeProvider().available();

            for (final ITheme theme : themes) {
                final PageParameters params = new PageParameters();
                params.set("theme", theme.name());

                subMenu.add(new MenuBookmarkablePageLink<Page>(page.getPageClass(), params,
                        Model.of(theme.name())));
            }

            return subMenu;
        }
    }.setIconType(IconType.book);
}

From source file:org.devgateway.eudevfin.dim.NavbarInitializer.java

License:Open Source License

@WicketNavbarComponentInitializer(position = Navbar.ComponentPosition.RIGHT, order = 10)
public static Component newLanguageNavbarButton(final Page page) {
    final NavbarDropDownButton languageDropDown = new NavbarDropDownButton(
            new StringResourceModel("navbar.lang", page, null, null)) {
        private static final long serialVersionUID = 2866997914075956070L;

        @Override//from  www  . jav  a2  s . c  o m
        public boolean isActive(final Component item) {
            return false;
        }

        @SuppressWarnings("Convert2Diamond")
        @Override
        protected List<AbstractLink> newSubMenuButtons(final String buttonMarkupId) {
            final List<AbstractLink> list = new ArrayList<>();
            list.add(new MenuHeader(new StringResourceModel("navbar.lang.header", this, null, null)));
            list.add(new MenuDivider());

            // TODO: get available languages
            final List<Locale> langs = new ArrayList<>();

            langs.add(new Locale("en"));
            langs.add(new Locale("hr"));
            langs.add(new Locale("cs"));
            langs.add(new Locale("bg"));
            langs.add(new Locale("hu"));
            langs.add(new Locale("lv"));
            langs.add(new Locale("lt"));
            langs.add(new Locale("pl"));
            langs.add(new Locale("ro"));
            langs.add(new Locale("sl"));

            for (final Locale l : langs) {
                final PageParameters params = new PageParameters(page.getPageParameters());
                params.set(Constants.LANGUAGE_PAGE_PARAM, l.getLanguage());
                list.add(new MenuBookmarkablePageLink<Page>(page.getPageClass(), params,
                        Model.of(l.getDisplayName())));
            }

            return list;
        }
    };
    languageDropDown.setIconType(IconType.flag);
    languageDropDown.add(new DropDownAutoOpen());
    return languageDropDown;
}

From source file:org.geoserver.security.web.AbstractSecurityWicketTestSupport.java

License:Open Source License

private void initializeForService(String name, String panelName) {
    Page page = new UserGroupRoleServicesPage();
    tester.startPage(page);//from ww  w  .j a  v a2s.  c o m
    tester.assertRenderedPage(page.getPageClass());

    SecurityNamedServicesPanel panel = (SecurityNamedServicesPanel) page.get("panel:panel:" + panelName);

    //          AjaxTabbedPanel tabbedPanel=  (AjaxTabbedPanel) page.get(AbstractSecurityPage.TabbedPanelId);
    //          String linkId = tabbedPanel.getId()+":tabs-container:tabs:"+tabIndex+":link";        
    //          tester.clickLink(linkId,true);

    DataView<SecurityNamedServiceConfig> dv = (DataView<SecurityNamedServiceConfig>) panel
            .get("table:listContainer:items");
    //page.get("tabbedPanel:panel:table:listContainer:items");

    Iterator<Item<SecurityNamedServiceConfig>> it = dv.getItems();
    while (it.hasNext()) {
        Item<SecurityNamedServiceConfig> item = it.next();
        if (name.equals(item.getModelObject().getName()))
            tester.clickLink(item.getPageRelativePath() + ":itemProperties:0:component:link");
    }
}

From source file:org.headsupdev.agile.framework.HeadsUpPageFactory.java

License:Open Source License

protected void configurePage(Page ret, PageParameters params) {
    if (ret instanceof HeadsUpPage) {
        HeadsUpPage page = ((HeadsUpPage) ret);

        Application app = ApplicationPageMapper.get().getApplication(ret.getPageClass());
        if (app == null || ApplicationPageMapper.isHomeApp(app)) {
            app = ApplicationPageMapper.get().getApplication("dashboard");
            if (app == null) {
                app = ApplicationPageMapper.get().getApplication("home");
            }/*from  w w w.  j  a v a2s  .c o  m*/
        }
        page.setApplication(app);

        if (params != null) {
            page.setPageParameters(params);
        }

        page.layout();
    } else if (ret instanceof AbstractFeed) {
        if (params != null) {
            ((AbstractFeed) ret).setPageParameters(params);
        }
    }
    // TODO inject etc
}