org.apache.wicket.request.mapper.parameter.PageParameters Java Examples
The following examples show how to use
org.apache.wicket.request.mapper.parameter.PageParameters.
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: ODocumentsPage.java From Orienteer with Apache License 2.0 | 6 votes |
@Override protected IModel<List<ODocument>> resolveByPageParameters(PageParameters params) { String docs = params.get("docs").toOptionalString(); IModel<List<ODocument>> result = new ListModel<>(); if (!Strings.isNullOrEmpty(docs)) { List<ODocument> docsList = new LinkedList<>(); result.setObject(docsList); if (docs.contains(",")) { String [] rids = docs.split(","); for (String rid : rids) { docsList.add(new ORecordId(rid).getRecord()); } } else { docsList.add(new ORecordId(docs).getRecord()); } } return result; }
Example #2
Source File: DocumentationPage.java From projectforge-webapp with GNU General Public License v3.0 | 6 votes |
public DocumentationPage(final PageParameters parameters) { super(parameters); final Locale locale = PFUserContext.getLocale(); final boolean isGerman = locale != null && locale.toString().startsWith("de") == true; addDocLink(body, "newsLink", "doc/News.html"); addDocLink(body, "tutorialLink", "doc/ProjectForge.html"); addDocLink(body, "handbookLink", "doc/UserGuide.html"); if (isGerman == true) { addDocLink(body, "faqLink", "doc/FAQ_de.html"); } else { addDocLink(body, "faqLink", "doc/FAQ.html"); } addDocLink(body, "licenseLink", "LICENSE.txt"); addDocLink(body, "adminLogbuchLink", "doc/AdminLogbuch.html"); addDocLink(body, "adminGuideLink", "doc/AdministrationGuide.html"); addDocLink(body, "developerGuideLink", "doc/DeveloperGuide.html"); addDocLink(body, "projectDocLink", "site/index.html"); addDocLink(body, "javaDocLink", "site/apidocs/index.html"); }
Example #3
Source File: ProductItemPanel.java From the-app with Apache License 2.0 | 6 votes |
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 #4
Source File: Self.java From syncope with Apache License 2.0 | 6 votes |
@Override @SuppressWarnings("unchecked") public void onEvent(final IEvent<?> event) { if (event.getPayload() instanceof AjaxWizard.NewItemEvent) { if (event.getPayload() instanceof AjaxWizard.NewItemCancelEvent) { @SuppressWarnings("unchecked") final Class<? extends WebPage> beforeLogout = (Class<? extends WebPage>) SyncopeEnduserSession.get(). getAttribute(Constants.BEFORE_LOGOUT_PAGE); if (beforeLogout == null) { SyncopeEnduserSession.get().invalidate(); setResponsePage(getApplication().getHomePage()); } else { setResponsePage(beforeLogout); } } else if (event.getPayload() instanceof AjaxWizard.NewItemFinishEvent) { SyncopeEnduserSession.get().invalidate(); final PageParameters parameters = new PageParameters(); parameters.add(Constants.NOTIFICATION_MSG_PARAM, getString("self.wizard.success")); setResponsePage(getApplication().getHomePage(), parameters); } } super.onEvent(event); }
Example #5
Source File: AbstractMobileViewPage.java From projectforge-webapp with GNU General Public License v3.0 | 6 votes |
protected AbstractMobileViewPage(final PageParameters parameters) { super(parameters); final Integer id = WicketUtils.getAsInteger(parameters, AbstractEditPage.PARAMETER_KEY_ID); data = null; if (NumberHelper.greaterZero(id) == true) { data = getBaseDao().getById(id); } if (data == null) { // Create empty address for avoiding NPE... data = getBaseDao().newInstance(); getLogger().error("Oups, no object id given. Can't display object."); setResponsePage(getListPageClass()); return; } final RepeatingView flowfields = new RepeatingView("flowfields"); pageContainer.add(flowfields); gridBuilder = new MobileGridBuilder(flowfields); }
Example #6
Source File: AbstractWebPage.java From yes-cart with Apache License 2.0 | 6 votes |
/** * Construct page. * * @param params page parameters */ public AbstractWebPage(final PageParameters params) { super(params); final ShoppingCart cart = ApplicationDirector.getShoppingCart(); if (cart == null) { // Abnormal flow (possibly due incorrect URL pattern) setResponsePage(Application.get().getHomePage()); } if (cart != null) { if (StringUtils.isBlank(cart.getCurrentLocale())) { getShoppingCartCommandFactory().execute(cart, Collections.singletonMap( ShoppingCartCommand.CMD_CHANGELOCALE, getSession().getLocale().getLanguage() )); } // reinstate the current cart language as our session is transient getSession().setLocale(new Locale(cart.getCurrentLocale())); } setStatelessHint(true); }
Example #7
Source File: LinksSupportImpl.java From yes-cart with Apache License 2.0 | 6 votes |
/** {@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 #8
Source File: IssueBoardsPage.java From onedev with MIT License | 6 votes |
private void doQuery(AjaxRequestTarget target) { if (backlog) { backlogQueryString = queryInput.getModelObject(); getPageParameters().set(PARAM_BACKLOG_QUERY, backlogQueryString); } else { queryString = queryInput.getModelObject(); getPageParameters().set(PARAM_QUERY, queryString); } PageParameters params = IssueBoardsPage.paramsOf(getProject(), getBoard(), getMilestone(), backlog, queryString, backlogQueryString); CharSequence url = RequestCycle.get().urlFor(IssueBoardsPage.class, params); pushState(target, url.toString(), queryInput.getModelObject()); target.add(body); target.appendJavaScript("$(window).resize();"); }
Example #9
Source File: ReportDataPage.java From sakai with Educational Community License v2.0 | 6 votes |
public ReportDataPage(final ReportDefModel reportDef, final PageParameters pageParameters, final WebPage returnPage) { this.reportDefModel = reportDef; realSiteId = Locator.getFacade().getToolManager().getCurrentPlacement().getContext(); if(pageParameters != null) { siteId = pageParameters.get("siteId").toString(); inPrintVersion = pageParameters.get("printVersion").toBoolean(false); } if(siteId == null){ siteId = realSiteId; } if(returnPage == null) { this.returnPage = new ReportsPage(pageParameters); }else{ this.returnPage = returnPage; } boolean allowed = Locator.getFacade().getStatsAuthz().isUserAbleToViewSiteStats(siteId); if(allowed) { if(reportDef != null && getReportDef() != null && getReportDef().getReportParams() != null) { renderBody(); }else{ setResponsePage(ReportsPage.class); } }else{ setResponsePage(NotAuthorizedPage.class); } }
Example #10
Source File: DashboardPage.java From artifact-listener with Apache License 2.0 | 6 votes |
public DashboardPage(PageParameters parameters) { super(parameters); addBodyCssClass("force-vertical-scroll"); addHeadPageTitleElement(new BreadCrumbElement(new ResourceModel("dashboard.pageTitle"))); addBreadCrumbElement(new BreadCrumbElement(new ResourceModel("dashboard.pageTitle"), DashboardPage.linkDescriptor())); add(new Label("pageTitle", new ResourceModel("dashboard.pageTitle"))); DashboardNotificationListViewPanel notificationsPanel = new DashboardNotificationListViewPanel("notificationPanel", new NotificationsModel(MavenArtifactNotifierSession.get().getUserModel())); add(notificationsPanel); DashboardArtifactPortfolioPanel artifactPanel = new DashboardArtifactPortfolioPanel("artifactPanel", new LoadableDetachableModel<Collection<FollowedArtifact>>() { private static final long serialVersionUID = -8484961470906264804L; @Override protected Collection<FollowedArtifact> load() { return userService.listFollowedArtifacts(MavenArtifactNotifierSession.get().getUser()); } }); add(artifactPanel); }
Example #11
Source File: PullRequestActivitiesPage.java From onedev with MIT License | 6 votes |
public PullRequestActivitiesPage(PageParameters params) { super(params); WebRequest request = (WebRequest) RequestCycle.get().getRequest(); Cookie cookie = request.getCookie(COOKIE_SHOW_COMMENTS); if (cookie != null) showComments = Boolean.valueOf(cookie.getValue()); cookie = request.getCookie(COOKIE_SHOW_COMMITS); if (cookie != null) showCommits = Boolean.valueOf(cookie.getValue()); cookie = request.getCookie(COOKIE_SHOW_CHANGE_HISTORY); if (cookie != null) showChangeHistory = Boolean.valueOf(cookie.getValue()); }
Example #12
Source File: ProjectDashboardPage.java From inception with Apache License 2.0 | 6 votes |
public ProjectDashboardPage(final PageParameters aPageParameters) { super(aPageParameters); User currentUser = userRepository.getCurrentUser(); // Check if use can access the project Project project = projectService.listAccessibleProjects(currentUser).stream() .filter(p -> p.getId().equals( aPageParameters.get(PAGE_PARAM_PROJECT_ID).toOptionalLong())) .findFirst() .orElse(null); // If the user has no access, send the user back to the overview page if (project == null) { setResponsePage(ProjectsOverviewPage.class); } // Otherwise make the project the current project Session.get().setMetaData(CURRENT_PROJECT, project); commonInit(); }
Example #13
Source File: LinksSupportImpl.java From yes-cart with Apache License 2.0 | 6 votes |
/** {@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 #14
Source File: CustomerEditPageTest.java From wicket-spring-boot with Apache License 2.0 | 5 votes |
@Test public void assert_customer_on_load_existing(){ PageParameters params = new PageParameters(); params.add(CustomerEditPage.CUSTOMER_ID_PARAM, "3"); getTester().startPage(CustomerEditPage.class, params); getTester().assertNoErrorMessage(); getTester().assertNoInfoMessage(); getTester().assertRenderedPage(CustomerEditPage.class); FormTester formTester = getTester().newFormTester("form"); String username = formTester.getTextComponentValue(borderPath("username")); String firstname = formTester.getTextComponentValue(borderPath("firstname")); String lastname = formTester.getTextComponentValue(borderPath("lastname")); assertThat(username, equalTo("username3")); assertThat(firstname, equalTo("firstname3")); assertThat(lastname, equalTo("lastname3")); getTester().debugComponentTrees(); String usernameFieldPath = "form:" + borderPath("username"); getTester().assertComponent(usernameFieldPath, UsernameTextField.class); getTester().isDisabled(usernameFieldPath); String passwordFieldPath = "form:" + borderPath("password"); getTester().isInvisible(passwordFieldPath); }
Example #15
Source File: BasePage.java From sakai with Educational Community License v2.0 | 5 votes |
/** * Send a user to the access denied page with a message * * @param message the message */ public final void sendToAccessDeniedPage(final String message) { final PageParameters params = new PageParameters(); params.add("message", message); log.debug("Redirecting to AccessDeniedPage: " + message); throw new RestartResponseException(AccessDeniedPage.class, params); }
Example #16
Source File: TestHashPage.java From openmeetings with Apache License 2.0 | 5 votes |
private void checkMainPanel(PageParameters pp, Class<? extends Panel> clazz) { HashPage page = commonCheck(pp); tester.assertComponent(PANEL_MAIN, MainPanel.class); tester.assertInvisible("header"); WebSocketTester webSocketTester = new WebSocketTester(tester, page); webSocketTester.sendMessage(CONNECTED_MSG); tester.assertComponent(String.format("%s:contents:%s", PANEL_MAIN, CHILD_ID), clazz); }
Example #17
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 #18
Source File: Security.java From syncope with Apache License 2.0 | 5 votes |
public Security(final PageParameters parameters) { super(parameters); body.add(BookmarkablePageLinkBuilder.build("dashboard", "dashboardBr", Dashboard.class)); WebMarkupContainer content = new WebMarkupContainer("content"); content.setOutputMarkupId(true); content.setMarkupId("security"); content.add(new AjaxBootstrapTabbedPanel<>("tabbedPanel", buildTabList())); body.add(content); }
Example #19
Source File: MilestoneListPage.java From onedev with MIT License | 5 votes |
public static PageParameters paramsOf(Project project, boolean closed, @Nullable MilestoneSort sort) { PageParameters params = paramsOf(project); if (closed) params.add(PARAM_STATE, "closed"); else params.add(PARAM_STATE, "open"); if (sort != null) params.add(PARAM_SORT, sort.name().toLowerCase()); return params; }
Example #20
Source File: WicketUtilTest.java From yes-cart with Apache License 2.0 | 5 votes |
@Test public void testGetFilteredRequestParametersKeyName() throws Exception { final CommandConfig commandConfig = context.mock(CommandConfig.class, "config"); context.checking(new Expectations() {{ allowing(commandConfig).isCommandKey("asd"); will(returnValue(false)); allowing(commandConfig).isCommandKey("toRemove"); will(returnValue(false)); allowing(commandConfig).isCommandKey("cmd1"); will(returnValue(true)); }}); assertNotNull(new WicketUtil(commandConfig).getFilteredRequestParameters(null)); PageParameters parametersToFilter = new PageParameters() .add("cmd1", "val1") .add("asd", "dsa") .add("toRemove", "ppp") .add("toRemove", "zzz"); assertEquals(3, parametersToFilter.getNamedKeys().size()); assertEquals(2, new WicketUtil(commandConfig).getFilteredRequestParameters(parametersToFilter).getNamedKeys().size()); PageParameters filtered = new WicketUtil(commandConfig).getFilteredRequestParameters(parametersToFilter, "toRemove", null); assertNotNull(filtered); assertEquals(2, filtered.getNamedKeys().size()); assertEquals("dsa", filtered.get("asd").toString()); assertEquals("ppp", filtered.getValues("toRemove").get(0).toString()); assertEquals("zzz", filtered.getValues("toRemove").get(1).toString()); filtered = new WicketUtil(commandConfig).getFilteredRequestParameters(parametersToFilter, "toRemove", "zzz"); assertNotNull(filtered); assertEquals(2, filtered.getNamedKeys().size()); assertEquals("dsa", filtered.get("asd").toString()); assertEquals(1, filtered.getValues("toRemove").size()); assertEquals("ppp", filtered.getValues("toRemove").get(0).toString()); filtered = new WicketUtil(commandConfig).getFilteredRequestParameters(parametersToFilter, "toRemove", "ppp"); assertNotNull(filtered); assertEquals(2, filtered.getNamedKeys().size()); assertEquals("dsa", filtered.get("asd").toString()); assertEquals(1, filtered.getValues("toRemove").size()); assertEquals("zzz", filtered.getValues("toRemove").get(0).toString()); }
Example #21
Source File: ProfileImageResourceReference.java From openmeetings with Apache License 2.0 | 5 votes |
public static String getUrl(RequestCycle rc, User u) { String uri = u.getPictureUri(); if (isRelative(uri)) { File img = OmFileHelper.getUserProfilePicture(u.getId(), uri); uri = rc.urlFor(new ProfileImageResourceReference() , new PageParameters().add("id", u.getId()).add("anticache", img.lastModified())).toString(); } return uri; }
Example #22
Source File: ModeUrlResourceReference.java From onedev with MIT License | 5 votes |
@Override public List<HeaderItem> getDependencies() { List<HeaderItem> dependencies = super.getDependencies(); WebjarsJavaScriptResourceReference metaReference = new WebjarsJavaScriptResourceReference("codemirror/current/mode/meta.js"); String modeBase = StringUtils.substringBeforeLast(RequestCycle.get().urlFor(metaReference, new PageParameters()).toString(), "/"); dependencies.add(OnDomReadyHeaderItem.forScript("CodeMirror.modeURL = '" + modeBase + "/%N/%N.js';")); return dependencies; }
Example #23
Source File: JobDefLink.java From onedev with MIT License | 5 votes |
@Override public PageParameters getPageParameters() { ProjectBlobPage.State state = new ProjectBlobPage.State(); state.blobIdent = new BlobIdent(commitId.name(), BuildSpec.BLOB_PATH, FileMode.REGULAR_FILE.getBits()); if (getProject().getBlob(state.blobIdent, false) == null) state.blobIdent = new BlobIdent(commitId.name(), ".onedev-buildspec", FileMode.REGULAR_FILE.getBits()); state.position = BuildSpecRendererProvider.getPosition(Job.SELECTION_PREFIX + jobName); return ProjectBlobPage.paramsOf(getProject(), state); }
Example #24
Source File: ProjectPage.java From webanno with Apache License 2.0 | 5 votes |
public ProjectPage(final PageParameters aPageParameters) { super(aPageParameters); commonInit(); preSelectedModelMode = true; sidebar.setVisible(false); // Fetch project parameter StringValue projectParameter = aPageParameters.get(PAGE_PARAM_PROJECT_ID); // Check if we are asked to create a new project if (projectParameter != null && NEW_PROJECT_ID.equals(projectParameter.toString())) { selectedProject.setObject(new Project()); } // Check if we are asked to open an existing project else { Optional<Project> project = getProjectFromParameters(projectParameter); if (project.isPresent()) { // Check access to project if (!projectService.isAdmin(project.get(), userRepository.getCurrentUser())) { error("You have no permission to access project [" + project.get().getId() + "]"); setResponsePage(getApplication().getHomePage()); } selectedProject.setObject(project.get()); } else { error("Project [" + projectParameter + "] does not exist"); setResponsePage(getApplication().getHomePage()); } } }
Example #25
Source File: UserPageSiteSearch.java From sakai with Educational Community License v2.0 | 5 votes |
public UserPageSiteSearch(PageParameters params){ String search = ""; if(params.getNamedKeys().contains("search")){ search = params.get("search").toString(); } Map<String, Object> advancedFields = new HashMap<String, Object>(); if(params.getNamedKeys().contains("term")){ advancedFields.put(DelegatedAccessConstants.ADVANCED_SEARCH_TERM, params.get("term").toString()); } if(params.getNamedKeys().contains("instructor")){ advancedFields.put(DelegatedAccessConstants.ADVANCED_SEARCH_INSTRUCTOR, params.get("instructor").toString()); //set type: String instructorType = DelegatedAccessConstants.ADVANCED_SEARCH_INSTRUCTOR_TYPE_INSTRUCTOR; if(params.getNamedKeys().contains("instructorType") && DelegatedAccessConstants.ADVANCED_SEARCH_INSTRUCTOR_TYPE_MEMBER.equals(params.get("instructorType").toString())){ instructorType = DelegatedAccessConstants.ADVANCED_SEARCH_INSTRUCTOR_TYPE_MEMBER; } advancedFields.put(DelegatedAccessConstants.ADVANCED_SEARCH_INSTRUCTOR_TYPE, instructorType); } //we have at least one hierarchy key/value: Map<String, String> hierarchyParams = new HashMap<String, String>(); int i = 0; while(params.getNamedKeys().contains("hierarchyKey" + i) && params.getNamedKeys().contains("hierarchyValue" + i)){ hierarchyParams.put(params.get("hierarchyKey").toString() + i, params.get("hierarchyValue").toString() + i); i++; } if(hierarchyParams.size() > 0){ advancedFields.put(DelegatedAccessConstants.ADVANCED_SEARCH_HIERARCHY_FIELDS, hierarchyParams); } buildPage(search, advancedFields, false, false); }
Example #26
Source File: WicketUtils.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
/** * Tuples of parameters converted to Wicket parameters. * @param params * @return */ public static PageParameters getPageParameters(final String[] params) { final PageParameters pageParameters = new PageParameters(); if (params != null) { for (int i = 0; i < params.length; i += 2) { if (i + 1 < params.length) { pageParameters.add(params[i], params[i + 1]); } else { pageParameters.add(params[i], null); } } } return pageParameters; }
Example #27
Source File: ProjectDashboardPage.java From onedev with MIT License | 5 votes |
public ProjectDashboardPage(PageParameters params) { super(params); if (SecurityUtils.canReadCode(getProject())) throw new RestartResponseException(ProjectBlobPage.class, ProjectBlobPage.paramsOf(getProject())); else throw new RestartResponseException(ProjectIssueListPage.class, ProjectIssueListPage.paramsOf(getProject())); }
Example #28
Source File: Application.java From openmeetings with Apache License 2.0 | 5 votes |
public static String urlForPage(Class<? extends Page> clazz, PageParameters pp, String inBaseUrl) { RequestCycle rc = RequestCycle.get(); String baseUrl = isUrlValid(inBaseUrl) ? inBaseUrl : (isUrlValid(getBaseUrl()) ? getBaseUrl() : ""); if (!Strings.isEmpty(baseUrl) && !baseUrl.endsWith("/")) { baseUrl += "/"; } return rc.getUrlRenderer().renderFullUrl(Url.parse(baseUrl + rc.mapUrlFor(clazz, pp))); }
Example #29
Source File: MysqlPatcher.java From openmeetings with Apache License 2.0 | 5 votes |
@Override protected String getUrl(String inUrl, String host, String inPort, String inDb) { Url url = Url.parse(inUrl); url.setHost(host); url.setPort((inPort == null) ? 3306 : Integer.valueOf(inPort)); url.getSegments().set(1, (inDb == null) ? DEFAULT_DB_NAME : inDb); PageParameters pp = new PageParametersEncoder().decodePageParameters(url); StringValue tz = pp.get(TZ_PARAM); if (tz.isEmpty()) { url.setQueryParameter(TZ_PARAM, TimeZone.getDefault().getID()); } return url.toString(Url.StringMode.FULL); }
Example #30
Source File: NewPullRequestPage.java From onedev with MIT License | 5 votes |
public static PageParameters paramsOf(Project project, ProjectAndBranch target, ProjectAndBranch source) { PageParameters params = paramsOf(project); if (target.getBranch() != null) params.set("target", target.toString()); else params.set("target", target.getProjectId()); if (source.getBranch() != null) params.set("source", source.toString()); else params.set("source", source.getProjectId()); return params; }