Java Code Examples for org.apache.wicket.request.mapper.parameter.PageParameters#set()

The following examples show how to use org.apache.wicket.request.mapper.parameter.PageParameters#set() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LinksSupportImpl.java    From yes-cart with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
@SuppressWarnings("unchecked")
public Link newRemoveFromWishListLink(final String linkId,
                                      final String supplier,
                                      final String skuCode,
                                      final Long itemId,
                                      final Class<Page> target,
                                      final PageParameters pageParameters) {

    final PageParameters params = getFilteredCurrentParameters(pageParameters);
    params.set(ShoppingCartCommand.CMD_REMOVEFROMWISHLIST, skuCode);
    params.set(ShoppingCartCommand.CMD_P_SUPPLIER, supplier);
    params.set(ShoppingCartCommand.CMD_REMOVEFROMWISHLIST_P_ID, itemId);
    return new BookmarkablePageLink(linkId, target, params);
}
 
Example 2
Source File: LinksSupportImpl.java    From yes-cart with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
@SuppressWarnings("unchecked")
public Link newAddToCartLink(final String linkId,
                             final String supplier,
                             final String skuCode,
                             final String quantity,
                             final String wishlistId,
                             final Class<Page> target,
                             final PageParameters pageParameters) {

    final PageParameters params = getFilteredCurrentParameters(pageParameters);
    params.set(ShoppingCartCommand.CMD_ADDTOCART, skuCode);
    params.set(ShoppingCartCommand.CMD_P_SUPPLIER, supplier);
    params.set(ShoppingCartCommand.CMD_REMOVEFROMWISHLIST, skuCode);
    params.set(ShoppingCartCommand.CMD_REMOVEFROMWISHLIST_P_ID, wishlistId);
    if (quantity != null) { // null quantity will pick min from product
        params.set(ShoppingCartCommand.CMD_P_QTY, quantity);
    }
    return new BookmarkablePageLink(linkId, target, params);
}
 
Example 3
Source File: LinksSupportImpl.java    From yes-cart with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
@SuppressWarnings("unchecked")
public Link newAddToCartLink(final String linkId,
                             final String supplier,
                             final String skuCode,
                             final String quantity,
                             final PageParameters pageParameters) {

    final PageParameters params = getFilteredCurrentParameters(pageParameters);
    params.set(ShoppingCartCommand.CMD_ADDTOCART, skuCode);
    params.set(ShoppingCartCommand.CMD_P_SUPPLIER, supplier);
    if (quantity != null) { // null quantity will pick min from product
        params.set(ShoppingCartCommand.CMD_P_QTY, quantity);
    }
    return new BookmarkablePageLink(linkId, getHomePage(), params);
}
 
Example 4
Source File: URLPagingNavigator.java    From yes-cart with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected AbstractLink newPagingNavigationLink(final String id, final IPageable pageable, int pageNumber) {

    final LinksSupport links = ((AbstractWebPage) getPage()).getWicketSupportFacade().links();
    final PageParameters params = links.getFilteredCurrentParameters(pageParameters);

    final long pNum;

    if ("last".equals(id)) {
        pNum = getPageable().getPageCount() - 1;
    } else {
        pNum = pageNumber;
    }

    params.set(WebParametersKeys.PAGE, pNum);

    return (AbstractLink) links.newLink(id, params).add(new AttributeModifier("class", "nav-page-control " + id));

}
 
Example 5
Source File: ProductItemPanel.java    From AppStash with Apache License 2.0 6 votes vote down vote up
private Component productDetailImageLink() {
    Link<Void> detailPageLink = new Link<Void>("productDetailLink") {
        @Override
        public void onClick() {
            PageParameters pageParameters = new PageParameters();
            pageParameters.set("urlname", productUrlModel.getObject());
            setResponsePage(new ProductDetailPage(pageParameters));
        }
    };
    WebMarkupContainer image = new WebMarkupContainer("image");
    image.add(new AttributeModifier("src", new ImageLinkModel(productInfoModel, this)));
    image.add(new AttributeModifier("title", new PropertyModel<String>(productInfoModel, "description")));
    image.add(new AttributeModifier("alt", new PropertyModel<String>(productInfoModel, "name")));
    image.setOutputMarkupId(true);

    detailPageLink.add(image);
    return detailPageLink;
}
 
Example 6
Source File: CreateEditAddressPage.java    From yes-cart with Apache License 2.0 6 votes vote down vote up
/**
 * Extension hook to override classes for themes.
 *
 * @param isCheckout where this is checkout registration
 * @param customer current customer
 *
 * @return redirect target
 */
protected Pair<Class<? extends Page>, PageParameters> determineSuccessTarget(boolean isCheckout, final Customer customer) {

    final Class<? extends Page> successfulPage;
    final PageParameters parameters = new PageParameters();

    if (isCheckout) {
        if (customer.isGuest()) {
            parameters.set("guest", "1");
        }
        successfulPage = (Class) wicketPagesMounter.getPageProviderByUri("/checkout").get();
    } else {
        successfulPage = (Class) wicketPagesMounter.getPageProviderByUri("/profile").get();
    }
    return new Pair<>(successfulPage, parameters);
}
 
Example 7
Source File: ProductPerPageListView.java    From yes-cart with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void populateItem(ListItem<String> stringListItem) {

    final String pageSize = stringListItem.getModelObject();
    final Label label = new Label(WebParametersKeys.QUANTITY, pageSize);

    final AbstractWebPage page = ((AbstractWebPage) getPage());
    final PageParameters pageParameters = page.getPageParameters();
    final LinksSupport links = page.getWicketSupportFacade().links();
    final PaginationSupport pagination = page.getWicketSupportFacade().pagination();

    final PageParameters params = links.getFilteredCurrentParameters(pageParameters);
    params.set(WebParametersKeys.QUANTITY, pageSize);

    final Link pageSizeLink = links.newLink(ITEMS_PER_PAGE, params);
    pageSizeLink.add(label);
    stringListItem.add(pageSizeLink);

    if (pagination.markSelectedPageSizeLink(pageSizeLink, pageParameters, getModelObject(), NumberUtils.toInt(pageSize))) {
        stringListItem.add(new AttributeModifier("class", "active"));
    }

}
 
Example 8
Source File: LinksSupportImpl.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
@SuppressWarnings("unchecked")
public Link newChangeCurrencyLink(final String linkId,
                                  final String currency,
                                  final Class<? extends Page> target,
                                  final PageParameters pageParameters) {

    final PageParameters params = getFilteredCurrentParameters(pageParameters);
    params.set(ShoppingCartCommand.CMD_CHANGECURRENCY, currency);
    return new BookmarkablePageLink(
            linkId,
            target == null ? getHomePage() : target,
            params);
}
 
Example 9
Source File: LinksSupportImpl.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
@SuppressWarnings("unchecked")
public Link newAddToWishListLink(final String linkId,
                                 final String supplier,
                                 final String skuCode,
                                 final String quantity,
                                 final String wishList,
                                 final String tags,
                                 final String visibility,
                                 final PageParameters pageParameters) {

    final PageParameters params = getFilteredCurrentParameters(pageParameters);
    params.set(ShoppingCartCommand.CMD_ADDTOWISHLIST, skuCode);
    params.set(ShoppingCartCommand.CMD_P_SUPPLIER, supplier);
    if (quantity != null) { // null quantity will pick min from product
        params.set(ShoppingCartCommand.CMD_P_QTY, quantity);
    }
    params.set(ShoppingCartCommand.CMD_ADDTOWISHLIST_P_TYPE, wishList != null ? wishList : CustomerWishList.SIMPLE_WISH_ITEM);
    if (visibility != null) {
        params.set(ShoppingCartCommand.CMD_ADDTOWISHLIST_P_VISIBILITY, visibility);
    } else {
        params.remove(ShoppingCartCommand.CMD_ADDTOWISHLIST_P_VISIBILITY);
    }
    if (tags != null) {
        params.set(ShoppingCartCommand.CMD_ADDTOWISHLIST_P_TAGS, tags);
    } else {
        params.remove(ShoppingCartCommand.CMD_ADDTOWISHLIST_P_TAGS);
    }
    return new BookmarkablePageLink(linkId, WishListItemAddPage.class, params);
}
 
Example 10
Source File: LinksSupportImpl.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
@SuppressWarnings("unchecked")
public Link newLogOffLink(final String linkId,
                          final PageParameters pageParameters) {

    final PageParameters params = getFilteredCurrentParameters(pageParameters);
    params.set(ShoppingCartCommand.CMD_LOGOUT, ShoppingCartCommand.CMD_LOGOUT);
    return new BookmarkablePageLink(linkId, getHomePage(), params);
}
 
Example 11
Source File: LinksSupportImpl.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public Link newRemoveCouponLink(final String linkId,
                                final String coupon,
                                final Class<Page> target,
                                final PageParameters pageParameters) {

    final PageParameters params = getFilteredCurrentParameters(pageParameters);
    params.set(ShoppingCartCommand.CMD_REMOVECOUPON, coupon);
    return new BookmarkablePageLink(linkId, target, params);
}
 
Example 12
Source File: AbstractODocumentAliasMapper.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
@Override
protected PageParameters extractPageParameters(Request request, Url url) {
    PageParameters parameters = super.extractPageParameters(request, url);
    String value = getValueAsString(parameters);

    if (value != null) {
        parameters.set(parameter, value);
    }

    return parameters;
}
 
Example 13
Source File: LinksSupportImpl.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
private Link newBookmarkableLink(final String linkId,
                                 final String supplier,
                                 final String uriContext,
                                 final Object uri,
                                 final PageParameters carried) {
    
    final PageParameters params = new PageParameters(carried);
    if (StringUtils.isNotBlank(supplier)) {
        params.set(WebParametersKeys.FULFILMENT_CENTRE_ID, supplier);
    }
    params.set(uriContext, uri);
    return new BookmarkablePageLink(linkId, getHomePage(), params);
}
 
Example 14
Source File: CustomerOrderPanel.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/**
 * Extension hook.
 *
 * @param order order
 *
 * @return view order page link
 */
protected Link determineOrderPageLink(final CustomerOrder order, final String linkId) {

    final PageParameters viewOrder = new PageParameters();
    viewOrder.set("order", order.getCartGuid());
    return new BookmarkablePageLink(linkId, OrderPage.class, viewOrder);

}
 
Example 15
Source File: ArchiveDownloadResource.java    From onedev with MIT License 5 votes vote down vote up
public static PageParameters paramsOf(Project project, String revision, String format) {
	PageParameters params = new PageParameters();
	params.set(PARAM_PROJECT, project.getName());
	params.set(PARAM_REVISION, revision);
	params.set(PARAM_FORMAT, format);
	
	return params;
}
 
Example 16
Source File: ShoppingCartItemsList.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/**
 * Create BookmarkablePageLink for remove one sku from cart command.
 *
 * @param skuCode   sku code
 * @param supplier  supplier
 *
 * @return BookmarkablePageLink for remove one sku from cart command
 */
private BookmarkablePageLink createRemoveOneSkuLink(final String skuCode, final String supplier) {
    final PageParameters paramsMap = new PageParameters();
    paramsMap.set(ShoppingCartCommand.CMD_REMOVEONESKU, skuCode);
    paramsMap.set(ShoppingCartCommand.CMD_P_SUPPLIER, supplier);
    return new BookmarkablePageLink<Page>(
            REMOVE_ONE_LINK,
            getPage().getPageClass(),
            paramsMap
    );
}
 
Example 17
Source File: HtmlReportDownloadResource.java    From onedev with MIT License 5 votes vote down vote up
public static PageParameters paramsOf(Project project, Long buildNumber, String reportName, String path) {
	PageParameters params = new PageParameters();
	params.set(PARAM_PROJECT, project.getName());
	params.set(PARAM_BUILD, buildNumber);
	params.set(PARAM_REPORT, reportName);
	params.set(PARAM_PATH, path);
	return params;
}
 
Example 18
Source File: MarkdownReportDownloadResource.java    From onedev with MIT License 5 votes vote down vote up
public static PageParameters paramsOf(Project project, Long buildNumber, String reportName, String path) {
	PageParameters params = new PageParameters();
	params.set(PARAM_PROJECT, project.getName());
	params.set(PARAM_BUILD, buildNumber);
	params.set(PARAM_REPORT, reportName);
	params.set(PARAM_PATH, path);
	return params;
}
 
Example 19
Source File: ProjectsOverviewPage.java    From inception with Apache License 2.0 4 votes vote down vote up
private void actionCreateProject(AjaxRequestTarget aTarget)
{
    PageParameters params = new PageParameters();
    params.set(WebAnnoConst.PAGE_PARAM_PROJECT_ID, ProjectPage.NEW_PROJECT_ID);
    setResponsePage(ProjectPage.class, params);        
}
 
Example 20
Source File: HideableBookmarkablePagingNavigator.java    From artifact-listener with Apache License 2.0 4 votes vote down vote up
@Override
protected AbstractLink newPagingNavigationLink(String id, IPageable pageable, int pageNumber) {
	PageParameters parameters = new PageParameters(getPage().getPageParameters());
	parameters.set(PAGE_NUMBER_PARAMETER, cullPageNumber(pageNumber));
	return new BookmarkablePageLink<Void>(id, getPage().getClass(), parameters);
}