Java Code Examples for org.apache.wicket.request.mapper.parameter.PageParameters#remove()
The following examples show how to use
org.apache.wicket.request.mapper.parameter.PageParameters#remove() .
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: WicketUtil.java From yes-cart with Apache License 2.0 | 6 votes |
/** * Get the filtered, from commands, request parameters, * that not contains given set of request parameter names * * @param parameters original request parameters * @return new filtered {@link PageParameters} */ public PageParameters getFilteredRequestParameters(final PageParameters parameters) { if (parameters != null) { final PageParameters rez = new PageParameters(parameters); for (final String key : parameters.getNamedKeys()) { if (commandConfig.isCommandKey(key)) { rez.remove(key); } } return rez; } return new PageParameters(); }
Example 2
Source File: ProductSorter.java From yes-cart with Apache License 2.0 | 6 votes |
/** * Get the product sort link by given sort filed and order. * * @param sortOrder sort order see {@link org.yes.cart.web.support.constants.WebParametersKeys#SORT} * and {@link org.yes.cart.web.support.constants.WebParametersKeys#SORT_REVERSE} * @param sortField sort by filed see {@link ProductSearchQueryBuilder} * @param id link id * @return product sort link */ private Link getSortLink(final String id, final String sortOrder, final String sortField) { final AbstractWebPage page = ((AbstractWebPage) getPage()); final LinksSupport links = page.getWicketSupportFacade().links(); final PaginationSupport pagination = page.getWicketSupportFacade().pagination(); final PageParameters pageParameters = page.getPageParameters(); final PageParameters params = links.getFilteredCurrentParameters(pageParameters); params.remove(WebParametersKeys.SORT); params.remove(WebParametersKeys.SORT_REVERSE); params.set(WebParametersKeys.PAGE, "0"); params.add(sortOrder, sortField); final Link rez = links.newLink(id, params); pagination.markSelectedSortLink(rez, pageParameters, sortOrder, sortField); return rez; }
Example 3
Source File: PullRequestChangesPage.java From onedev with MIT License | 5 votes |
@Override public PageParameters getParamsAfterEdit() { PageParameters params = getParamsBeforeEdit(); params.remove(PARAM_NEW_COMMIT); if (getOpenComment() != null) params.set(PARAM_OLD_COMMIT, getOpenComment().getMark().getCommitHash()); else params.remove(PARAM_OLD_COMMIT); return params; }
Example 4
Source File: WicketUtil.java From yes-cart with Apache License 2.0 | 5 votes |
/** * Get the filtered request parameters, that not contains given set of request parameter names * * @param pageParameters original request parameters * @param nameFilter set of parameter name to remove * @return new filtered {@link PageParameters} */ public PageParameters getFilteredRequestParameters(final PageParameters pageParameters, final Collection<String> nameFilter) { final PageParameters rez = getFilteredRequestParameters(pageParameters); for (String paramName : nameFilter) { rez.remove(paramName); } return rez; }
Example 5
Source File: WicketUtil.java From yes-cart with Apache License 2.0 | 5 votes |
/** * Get the filtered request parameters that does not * not contain given key and value. * * @param parameters original request parameters * @param key key part to remove * @param value value part to remove * @return new filtered {@link PageParameters} */ public PageParameters getFilteredRequestParameters(final PageParameters parameters, final String key, final String value) { final PageParameters rez = getFilteredRequestParameters(parameters); final List<StringValue> vals = rez.getValues(key); if (vals.size() > 0) { rez.remove(key, value); } else { rez.remove(key); } return rez; }
Example 6
Source File: WicketUtil.java From yes-cart with Apache License 2.0 | 5 votes |
/** * Get the retained request parameters, that not contains given set of request parameter names * * @param pageParameters original request parameters * @param nameFilter set of parameter name to retain * @return new filtered {@link PageParameters} */ public PageParameters getRetainedRequestParameters(final PageParameters pageParameters, final Set<String> nameFilter) { final PageParameters rez = getFilteredRequestParameters(pageParameters); for (String keyName : rez.getNamedKeys()) { if (!nameFilter.contains(keyName)) { rez.remove(keyName); } } return rez; }
Example 7
Source File: LinksSupportImpl.java From yes-cart with Apache License 2.0 | 5 votes |
/** {@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 8
Source File: BreadCrumbsBuilderImpl.java From yes-cart with Apache License 2.0 | 5 votes |
private void fillAttributes(final String locale, final List<Crumb> navigationCrumbs, final PageParameters pageParameters) { final Set<String> allowedAttributeNames = attributeService.getAllNavigatableAttributeCodes(); /* Call below creates very unproductive query for all attribute codes, so we use a separate method for that: this.attributeCodeName = attributeService.getAttributeNamesByCodes(allowedAttributeNames); */ final Map<String, I18NModel> attributeCodeName = attributeService.getAllAttributeNames(); // This is attributive only filtered navigation from request final PageParameters attributesOnly = wicketUtil.getRetainedRequestParameters( pageParameters, allowedAttributeNames); // Base hold category path from beginning and accumulate all attributive navigation final PageParameters base = wicketUtil.getFilteredRequestParameters( pageParameters, allowedAttributeNames); //If we are on display product page, we have to remove for filtering FC, product and sku base.remove(WebParametersKeys.FULFILMENT_CENTRE_ID); base.remove(WebParametersKeys.PRODUCT_ID); base.remove(WebParametersKeys.SKU_ID); for (PageParameters.NamedPair namedPair : attributesOnly.getAllNamed()) { final String displayValueName = determineDisplayValueName(namedPair.getKey(), namedPair.getValue(), locale); navigationCrumbs.add(createFilteredNavigationCrumb( base, namedPair.getKey(), namedPair.getValue(), displayValueName, locale, pageParameters, attributeCodeName)); } }
Example 9
Source File: WicketUtilTest.java From yes-cart with Apache License 2.0 | 5 votes |
@Test public void testGetFilteredRequestParametersForSearch() { PageParameters parametersToFilter = new PageParameters() .add("query", "val1") .add("query", "val2") .add("query", "val3"); assertEquals(1, parametersToFilter.getNamedKeys().size()); assertEquals(3, parametersToFilter.getValues("query").size()); parametersToFilter.remove("query", "val2"); assertEquals(2, parametersToFilter.getValues("query").size()); for (StringValue val : parametersToFilter.getValues("query")) { assertFalse("val2".equals(val.toString())); } }
Example 10
Source File: TransparentParameterPageEncoder.java From Orienteer with Apache License 2.0 | 5 votes |
@Override public Url encodePageParameters(PageParameters pageParameters) { StringValue sv = pageParameters.get(parameter); if (!sv.isEmpty()) { pageParameters.remove(parameter); } Url ret = super.encodePageParameters(pageParameters); if (!sv.isEmpty()) { pageParameters.add(parameter, sv.toString()); } return ret; }
Example 11
Source File: AbstractEditPage.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
/** * Removes id from the initial parameters set. * @see org.projectforge.web.wicket.AbstractSecuredPage#getBookmarkableInitialParameters() */ @Override public PageParameters getBookmarkableInitialParameters() { if (isNew() == true) { return new PageParameters(); } final PageParameters pageParameters = super.getBookmarkableInitialParameters(); pageParameters.remove("id"); // Don't show id if other extended parameters are given. return pageParameters; }
Example 12
Source File: ProjectListPage.java From onedev with MIT License | 4 votes |
public ProjectListPage(PageParameters params) { super(params); query = params.get(PARAM_QUERY).toOptionalString(); expectedCount = params.get(PARAM_EXPECTED_COUNT).toInt(0); params.remove(PARAM_EXPECTED_COUNT); }
Example 13
Source File: BuildListPage.java From onedev with MIT License | 4 votes |
public BuildListPage(PageParameters params) { super(params); query = params.get(PARAM_QUERY).toOptionalString(); expectedCount = params.get(PARAM_EXPECTED_COUNT).toInt(0); params.remove(PARAM_EXPECTED_COUNT); }
Example 14
Source File: PaginationSupportImpl.java From yes-cart with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override public void removePageParam(final PageParameters pageParameters) { pageParameters.remove(WebParametersKeys.PAGE); }