本文整理匯總了Java中org.apache.wicket.request.mapper.parameter.PageParameters類的典型用法代碼示例。如果您正苦於以下問題:Java PageParameters類的具體用法?Java PageParameters怎麽用?Java PageParameters使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PageParameters類屬於org.apache.wicket.request.mapper.parameter包,在下文中一共展示了PageParameters類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: processTheme
import org.apache.wicket.request.mapper.parameter.PageParameters; //導入依賴的package包/類
/**
* Sets the theme from the page parameters if applicable. An present but
* empty theme value will reset the theme (by unsetting the style).
*
* @param parameters page parameters to process
* @see VloWebAppParameters#THEME
* @see Session#setStyle(java.lang.String)
*/
private void processTheme(PageParameters parameters) {
final StringValue themeValue = parameters.get(VloWebAppParameters.THEME);
if (!themeValue.isNull()) {
if (themeValue.isEmpty()) {
// empty string resets theme
logger.debug("Resetting theme");
Session.get().setStyle(null);
} else {
// theme found, set it as style in the session
final String theme = themeValue.toString().toLowerCase();
logger.debug("Setting theme to {}", theme);
Session.get().setStyle(theme);
}
/*
* Remove theme parameter to prevent it from interfering with
* further processing, specifically the parameters check in
* the simple page search
*/
parameters.remove(VloWebAppParameters.THEME, themeValue.toString());
}
}
示例2: paramsOf
import org.apache.wicket.request.mapper.parameter.PageParameters; //導入依賴的package包/類
public static PageParameters paramsOf(Project project, State state) {
PageParameters params = paramsOf(project);
params.set(PARAM_REVISION, state.revision);
if (state.compareWith != null)
params.set(PARAM_COMPARE_WITH, state.compareWith);
if (state.whitespaceOption != WhitespaceOption.DEFAULT)
params.set(PARAM_WHITESPACE_OPTION, state.whitespaceOption.name());
if (state.pathFilter != null)
params.set(PARAM_PATH_FILTER, state.pathFilter);
if (state.blameFile != null)
params.set(PARAM_BLAME_FILE, state.blameFile);
if (state.commentId != null)
params.set(PARAM_COMMENT, state.commentId);
if (state.mark != null)
params.set(PARAM_MARK, state.mark.toString());
return params;
}
示例3: State
import org.apache.wicket.request.mapper.parameter.PageParameters; //導入依賴的package包/類
public State(PageParameters params) {
List<String> revisionSegments = new ArrayList<>();
String segment = params.get(PARAM_REVISION).toString();
if (segment.length() != 0)
revisionSegments.add(segment);
for (int i=0; i<params.getIndexedCount(); i++) {
segment = params.get(i).toString();
if (segment.length() != 0)
revisionSegments.add(segment);
}
revision = Joiner.on("/").join(revisionSegments);
compareWith = params.get(PARAM_COMPARE_WITH).toString();
whitespaceOption = WhitespaceOption.ofNullableName(params.get(PARAM_WHITESPACE_OPTION).toString());
pathFilter = params.get(PARAM_PATH_FILTER).toString();
blameFile = params.get(PARAM_BLAME_FILE).toString();
commentId = params.get(PARAM_COMMENT).toOptionalLong();
mark = MarkPos.fromString(params.get(PARAM_MARK).toString());
}
示例4: SearchOption
import org.apache.wicket.request.mapper.parameter.PageParameters; //導入依賴的package包/類
public SearchOption(PageParameters params) {
String value = params.get(PARAM_STATUS).toString();
if (value != null)
status = Status.valueOf(value);
submitterName = params.get(PARAM_SUBMITTER).toString();
targetBranch = params.get(PARAM_BRANCH).toString();
title = params.get(PARAM_TITLE).toString();
value = params.get(PARAM_BEGIN_DATE).toString();
if (value != null)
beginDate = new Date(Long.valueOf(value));
value = params.get(PARAM_END_DATE).toString();
if (value != null)
endDate = new Date(Long.valueOf(value));
}
示例5: RequestDetailPage
import org.apache.wicket.request.mapper.parameter.PageParameters; //導入依賴的package包/類
public RequestDetailPage(PageParameters params) {
super(params);
if (getProject().getDefaultBranch() == null)
throw new RestartResponseException(NoBranchesPage.class, paramsOf(getProject()));
requestModel = new LoadableDetachableModel<PullRequest>() {
@Override
protected PullRequest load() {
Long requestNumber = params.get(PARAM_REQUEST).toLong();
PullRequest request = GitPlex.getInstance(PullRequestManager.class).find(getProject(), requestNumber);
if (request == null)
throw new EntityNotFoundException("Unable to find request #" + requestNumber + " in project " + getProject());
return request;
}
};
reviewUpdateId = requestModel.getObject().getLatestUpdate().getId();
}
示例6: RequestChangesPage
import org.apache.wicket.request.mapper.parameter.PageParameters; //導入依賴的package包/類
public RequestChangesPage(PageParameters params) {
super(params);
state.commentId = params.get(PARAM_COMMENT).toOptionalLong();
state.mark = MarkPos.fromString(params.get(PARAM_MARK).toString());
state.oldCommit = params.get(PARAM_OLD_COMMIT).toString();
state.newCommit = params.get(PARAM_NEW_COMMIT).toString();
state.pathFilter = params.get(PARAM_PATH_FILTER).toString();
state.blameFile = params.get(PARAM_BLAME_FILE).toString();
state.whitespaceOption = WhitespaceOption.ofNullableName(params.get(PARAM_WHITESPACE_OPTION).toString());
PullRequest request = getPullRequest();
if (state.commentId != null) {
CodeComment comment = GitPlex.getInstance(CodeCommentManager.class).load(state.commentId);
if (state.oldCommit == null && state.newCommit == null) {
String commentCommit = comment.getCommentPos().getCommit();
if (commentCommit.equals(request.getBaseCommitHash())) {
state.oldCommit = request.getBaseCommitHash();
state.newCommit = request.getHeadCommitHash();
} else if (comment.isCodeChanged()) {
state.oldCommit = commentCommit;
state.newCommit = request.getHeadCommitHash();
} else {
state.oldCommit = request.getBaseCommitHash();
state.newCommit = commentCommit;
}
} else {
if (state.oldCommit == null)
state.oldCommit = request.getBaseCommitHash();
if (state.newCommit == null)
state.newCommit = request.getHeadCommitHash();
}
} else {
if (state.oldCommit == null)
state.oldCommit = request.getBaseCommitHash();
if (state.newCommit == null)
state.newCommit = request.getHeadCommitHash();
}
}
示例7: paramsOf
import org.apache.wicket.request.mapper.parameter.PageParameters; //導入依賴的package包/類
public static PageParameters paramsOf(PullRequest request, State state) {
PageParameters params = RequestDetailPage.paramsOf(request);
if (state.oldCommit != null)
params.set(PARAM_OLD_COMMIT, state.oldCommit);
if (state.newCommit != null)
params.set(PARAM_NEW_COMMIT, state.newCommit);
if (state.whitespaceOption != WhitespaceOption.DEFAULT)
params.set(PARAM_WHITESPACE_OPTION, state.whitespaceOption.name());
if (state.pathFilter != null)
params.set(PARAM_PATH_FILTER, state.pathFilter);
if (state.blameFile != null)
params.set(PARAM_BLAME_FILE, state.blameFile);
if (state.commentId != null)
params.set(PARAM_COMMENT, state.commentId);
if (state.mark != null)
params.set(PARAM_MARK, state.mark.toString());
return params;
}
示例8: CodeCommentsPage
import org.apache.wicket.request.mapper.parameter.PageParameters; //導入依賴的package包/類
public CodeCommentsPage(PageParameters params) {
super(params);
state = new State();
state.userName = params.get(PARAM_USER).toString();
state.unresolved = "yes".equals(params.get(PARAM_UNRESOLVED).toString());
state.path = params.get(PARAM_PATH).toString();
String value = params.get(PARAM_BEFORE).toString();
if (value != null)
state.before = new Date(Long.valueOf(value));
value = params.get(PARAM_AFTER).toString();
if (value != null)
state.after = new Date(Long.valueOf(value));
}
示例9: paramsOf
import org.apache.wicket.request.mapper.parameter.PageParameters; //導入依賴的package包/類
public static PageParameters paramsOf(PullRequest request, State state) {
PageParameters params = RequestDetailPage.paramsOf(request);
if (state.userName != null)
params.add(PARAM_USER, state.userName);
if (state.unresolved)
params.add(PARAM_UNRESOLVED, "yes");
if (state.path != null)
params.add(PARAM_PATH, state.path);
if (state.before != null)
params.add(PARAM_BEFORE, state.before.getTime());
if (state.after != null)
params.add(PARAM_AFTER, state.after.getTime());
return params;
}
示例10: paramsOf
import org.apache.wicket.request.mapper.parameter.PageParameters; //導入依賴的package包/類
public static PageParameters paramsOf(Project project, State state) {
PageParameters params = paramsOf(project);
if (state.blobIdent.revision != null)
params.set(PARAM_REVISION, state.blobIdent.revision);
if (state.blobIdent.path != null)
params.set(PARAM_PATH, state.blobIdent.path);
if (state.mark != null)
params.set(PARAM_MARK, state.mark.toString());
if (state.requestId != null)
params.set(PARAM_REQUEST, state.requestId);
if (state.commentId != null)
params.set(PARAM_COMMENT, state.commentId);
if (state.mode != Mode.VIEW)
params.set(PARAM_MODE, state.mode.name().toLowerCase());
if (state.query != null)
params.set(PARAM_QUERY, state.query);
return params;
}
示例11: paramsOf
import org.apache.wicket.request.mapper.parameter.PageParameters; //導入依賴的package包/類
public static PageParameters paramsOf(Project project, State state) {
PageParameters params = paramsOf(project);
params.set(PARAM_LEFT, state.leftSide.toString());
params.set(PARAM_RIGHT, state.rightSide.toString());
params.set(PARAM_COMPARE_WITH_MERGE_BASE, state.compareWithMergeBase);
if (state.whitespaceOption != WhitespaceOption.DEFAULT)
params.set(PARAM_WHITESPACE_OPTION, state.whitespaceOption.name());
if (state.pathFilter != null)
params.set(PARAM_PATH_FILTER, state.pathFilter);
if (state.blameFile != null)
params.set(PARAM_BLAME_FILE, state.blameFile);
if (state.mark != null)
params.set(PARAM_MARK, state.mark.toString());
if (state.tabPanel != null)
params.set(PARAM_TAB, state.tabPanel.name());
return params;
}
示例12: SummonerQueryForwardPage
import org.apache.wicket.request.mapper.parameter.PageParameters; //導入依賴的package包/類
public SummonerQueryForwardPage(PageParameters parameters) {
super(parameters, "Summoner Search", null);
// get summoner name and region sent by the form
String summonerName = parameters.get("summonerName").toString("");
String regionName = parameters.get("region").toString("").toUpperCase();
// insert data to error page
add(new Label("summoner_name", summonerName));
add(new Label("region", regionName));
// check if summoner name and region are valid, if not return to show error page
if (summonerName == null || summonerName.length() == 0) return;
if (!EnumUtils.isValidEnum(RiotEndpoint.class, regionName)) return;
// convert region name to RiotEndpoint object
RiotEndpoint region = RiotEndpoint.valueOf(regionName);
// generate the summoners statistic
Pair<String, SummonerStatisticItem> summonerStatistic = PageDataProvider.generateSummonerStatistic(summonerName, region);
// if statistic generation failed, return to show error page
if (summonerStatistic == null) return;
// forward to single summoner page with region and summoner key name
throw new RestartResponseAtInterceptPageException(SingleSummonerPage.class, new PageParameters()
.set(0, regionName).set(1, summonerStatistic.getKey()));
}
示例13: FacetedSearchPage
import org.apache.wicket.request.mapper.parameter.PageParameters; //導入依賴的package包/類
public FacetedSearchPage(PageParameters parameters, IModel<Boolean> simpleModeModel) {
super(parameters);
final QueryFacetsSelection selection = paramsConverter.fromParameters(parameters);
final IModel<QueryFacetsSelection> queryModel = new Model<>(selection);
setModel(queryModel);
createModels();
this.simpleModeModel = simpleModeModel;
addComponents();
// add Piwik tracking behavior
if (piwikConfig.isEnabled()) {
resultsHeader.add(AjaxPiwikTrackingBehavior.newEventTrackingBehavior(TRACKING_EVENT_TITLE));
}
}
示例14: ErrorPage
import org.apache.wicket.request.mapper.parameter.PageParameters; //導入依賴的package包/類
public ErrorPage(PageParameters parameters) {
super(parameters);
this.errorType = getErrorType(parameters.get(PAGE_PARAMETER_RESPONSE_CODE).toString());
final PageParameters queryParams = new PageParameters(parameters).remove(PAGE_PARAMETER_RESPONSE_CODE);
final boolean hasQuery = !queryParams.get(VloWebAppParameters.QUERY).isEmpty() || !queryParams.get(VloWebAppParameters.FILTER_QUERY).isEmpty();
add(new BookmarkablePageLink("searchPage", FacetedSearchPage.class, queryParams)
.add(new Label("label", hasQuery ? "Return to query" : "Go to the search page"))
);
final IModel<String> errorDescriptionModel = new LoadableDetachableModel<String>() {
@Override
protected String load() {
return getDescriptionForError(errorType);
}
};
add(new Label("description", errorDescriptionModel) {
@Override
protected void onConfigure() {
setVisible(errorDescriptionModel.getObject() != null);
}
}.setEscapeModelStrings(false));
}
示例15: buildMenus
import org.apache.wicket.request.mapper.parameter.PageParameters; //導入依賴的package包/類
private void buildMenus(MetronicMenu menu, BoxConfigurationData boxConfigurationMetadata,
ModuleEntity module, List<MenuItemConfig> subMenus) {
MetronicMenuGroup group = new MetronicMenuGroup(DefaultIcons.LAYERS, boxConfigurationMetadata.getLabel());
menu.addItem(group);
final List<Pair<Component, ISupplier<String>>> itens = new ArrayList<>();
for (MenuItemConfig t : subMenus) {
PageParameters pageParameters = new PageParameters();
pageParameters.add(MODULE_PARAM_NAME, module.getCod());
pageParameters.add(MENU_PARAM_NAME, boxConfigurationMetadata.getLabel());
pageParameters.add(ITEM_PARAM_NAME, t.name);
MetronicMenuItem i = new ServerMenuItem(t.icon, t.name, t.pageClass, t.page, pageParameters);
group.addItem(i);
itens.add(Pair.of(i.getHelper(), t.counterSupplier));
}
menu.add(new AddContadoresBehaviour(itens));
onBuildModuleGroup(group, menu);
}