當前位置: 首頁>>代碼示例>>Java>>正文


Java WicketUtils.getPath方法代碼示例

本文整理匯總了Java中com.gitblit.wicket.WicketUtils.getPath方法的典型用法代碼示例。如果您正苦於以下問題:Java WicketUtils.getPath方法的具體用法?Java WicketUtils.getPath怎麽用?Java WicketUtils.getPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.gitblit.wicket.WicketUtils的用法示例。


在下文中一共展示了WicketUtils.getPath方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: TicketPage

import com.gitblit.wicket.WicketUtils; //導入方法依賴的package包/類
public TicketPage(PageParameters params) {
	super(params);

	final String ticketFolder = WicketUtils.getPath(params);

	Repository r = getRepository();
	TicketModel t = TicgitUtils.getTicket(r, ticketFolder);

	add(new Label("ticketTitle", t.title));
	add(new Label("ticketId", t.id));
	add(new Label("ticketHandler", t.handler.toLowerCase()));
	add(WicketUtils.createTimestampLabel("ticketOpenDate", t.date, getTimeZone(), getTimeUtils()));
	Label stateLabel = new Label("ticketState", t.state);
	WicketUtils.setTicketCssClass(stateLabel, t.state);
	add(stateLabel);
	add(new Label("ticketTags", StringUtils.flattenStrings(t.tags)));

	ListDataProvider<Comment> commentsDp = new ListDataProvider<Comment>(t.comments);
	DataView<Comment> commentsView = new DataView<Comment>("comment", commentsDp) {
		private static final long serialVersionUID = 1L;
		int counter;

		public void populateItem(final Item<Comment> item) {
			final Comment entry = item.getModelObject();
			item.add(WicketUtils.createDateLabel("commentDate", entry.date, GitBlitWebSession
					.get().getTimezone(), getTimeUtils()));
			item.add(new Label("commentAuthor", entry.author.toLowerCase()));
			item.add(new Label("commentText", prepareComment(entry.text))
					.setEscapeModelStrings(false));
			WicketUtils.setAlternatingBackground(item, counter);
			counter++;
		}
	};
	add(commentsView);
}
 
開發者ID:warpfork,項目名稱:gitblit,代碼行數:36,代碼來源:TicketPage.java

示例2: PatchPage

import com.gitblit.wicket.WicketUtils; //導入方法依賴的package包/類
public PatchPage(PageParameters params) {
	super(params);

	if (!params.containsKey("r")) {
		GitBlitWebSession.get().cacheErrorMessage(getString("gb.repositoryNotSpecified"));
		redirectToInterceptPage(new RepositoriesPage());
		return;
	}

	final String repositoryName = WicketUtils.getRepositoryName(params);
	final String baseObjectId = WicketUtils.getBaseObjectId(params);
	final String objectId = WicketUtils.getObject(params);
	final String blobPath = WicketUtils.getPath(params);

	Repository r = GitBlit.self().getRepository(repositoryName);
	if (r == null) {
		GitBlitWebSession.get().cacheErrorMessage(getString("gb.canNotLoadRepository") + " " + repositoryName);
		redirectToInterceptPage(new RepositoriesPage());
		return;
	}

	RevCommit commit = JGitUtils.getCommit(r, objectId);
	if (commit == null) {
		GitBlitWebSession.get().cacheErrorMessage(getString("gb.commitIsNull"));
		redirectToInterceptPage(new RepositoriesPage());
		return;
	}

	RevCommit baseCommit = null;
	if (!StringUtils.isEmpty(baseObjectId)) {
		baseCommit = JGitUtils.getCommit(r, baseObjectId);
	}
	String patch = DiffUtils.getCommitPatch(r, baseCommit, commit, blobPath);
	add(new Label("patchText", patch));
	r.close();
}
 
開發者ID:warpfork,項目名稱:gitblit,代碼行數:37,代碼來源:PatchPage.java

示例3: MarkdownPage

import com.gitblit.wicket.WicketUtils; //導入方法依賴的package包/類
public MarkdownPage(PageParameters params) {
	super(params);

	final String markdownPath = WicketUtils.getPath(params);

	Repository r = getRepository();
	RevCommit commit = JGitUtils.getCommit(r, objectId);
	String [] encodings = GitBlit.getEncodings();
	
	// markdown page links
	add(new BookmarkablePageLink<Void>("blameLink", BlamePage.class,
			WicketUtils.newPathParameter(repositoryName, objectId, markdownPath)));
	add(new BookmarkablePageLink<Void>("historyLink", HistoryPage.class,
			WicketUtils.newPathParameter(repositoryName, objectId, markdownPath)));
	add(new BookmarkablePageLink<Void>("rawLink", RawPage.class, WicketUtils.newPathParameter(
			repositoryName, objectId, markdownPath)));
	add(new BookmarkablePageLink<Void>("headLink", MarkdownPage.class,
			WicketUtils.newPathParameter(repositoryName, Constants.HEAD, markdownPath)));

	// Read raw markdown content and transform it to html
	String markdownText = JGitUtils.getStringContent(r, commit.getTree(), markdownPath, encodings);
	String htmlText;
	try {
		htmlText = MarkdownUtils.transformMarkdown(markdownText);
	} catch (ParseException p) {
		markdownText = MessageFormat.format("<div class=\"alert alert-error\"><strong>{0}:</strong> {1}</div>{2}", getString("gb.error"), getString("gb.markdownFailure"), markdownText);
		htmlText = StringUtils.breakLinesForHtml(markdownText);
	}

	// Add the html to the page
	add(new Label("markdownText", htmlText).setEscapeModelStrings(false));
}
 
開發者ID:warpfork,項目名稱:gitblit,代碼行數:33,代碼來源:MarkdownPage.java

示例4: HistoryPage

import com.gitblit.wicket.WicketUtils; //導入方法依賴的package包/類
public HistoryPage(PageParameters params) {
	super(params);

	String path = WicketUtils.getPath(params);
	int pageNumber = WicketUtils.getPage(params);
	int prevPage = Math.max(0, pageNumber - 1);
	int nextPage = pageNumber + 1;

	HistoryPanel history = new HistoryPanel("historyPanel", repositoryName, objectId, path,
			getRepository(), -1, pageNumber - 1, getRepositoryModel().showRemoteBranches);
	boolean hasMore = history.hasMore();
	add(history);

	add(new BookmarkablePageLink<Void>("firstPageTop", HistoryPage.class,
			WicketUtils.newPathParameter(repositoryName, objectId, path))
			.setEnabled(pageNumber > 1));
	add(new BookmarkablePageLink<Void>("prevPageTop", HistoryPage.class,
			WicketUtils.newHistoryPageParameter(repositoryName, objectId, path, prevPage))
			.setEnabled(pageNumber > 1));
	add(new BookmarkablePageLink<Void>("nextPageTop", HistoryPage.class,
			WicketUtils.newHistoryPageParameter(repositoryName, objectId, path, nextPage))
			.setEnabled(hasMore));

	add(new BookmarkablePageLink<Void>("firstPageBottom", HistoryPage.class,
			WicketUtils.newPathParameter(repositoryName, objectId, path))
			.setEnabled(pageNumber > 1));
	add(new BookmarkablePageLink<Void>("prevPageBottom", HistoryPage.class,
			WicketUtils.newHistoryPageParameter(repositoryName, objectId, path, prevPage))
			.setEnabled(pageNumber > 1));
	add(new BookmarkablePageLink<Void>("nextPageBottom", HistoryPage.class,
			WicketUtils.newHistoryPageParameter(repositoryName, objectId, path, nextPage))
			.setEnabled(hasMore));

}
 
開發者ID:warpfork,項目名稱:gitblit,代碼行數:35,代碼來源:HistoryPage.java

示例5: BlobDiffPage

import com.gitblit.wicket.WicketUtils; //導入方法依賴的package包/類
public BlobDiffPage(PageParameters params) {
	super(params);

	final String blobPath = WicketUtils.getPath(params);
	final String baseObjectId = WicketUtils.getBaseObjectId(params);

	Repository r = getRepository();
	RevCommit commit = getCommit();

	DiffOutputType diffType = DiffOutputType.forName(GitBlit.getString(Keys.web.diffStyle,
			DiffOutputType.GITBLIT.name()));

	String diff;
	if (StringUtils.isEmpty(baseObjectId)) {
		// use first parent
		diff = DiffUtils.getDiff(r, commit, blobPath, diffType);
		add(new BookmarkablePageLink<Void>("patchLink", PatchPage.class,
				WicketUtils.newPathParameter(repositoryName, objectId, blobPath)));
	} else {
		// base commit specified
		RevCommit baseCommit = JGitUtils.getCommit(r, baseObjectId);
		diff = DiffUtils.getDiff(r, baseCommit, commit, blobPath, diffType);
		add(new BookmarkablePageLink<Void>("patchLink", PatchPage.class,
				WicketUtils.newBlobDiffParameter(repositoryName, baseObjectId, objectId,
						blobPath)));
	}

	add(new BookmarkablePageLink<Void>("commitLink", CommitPage.class,
			WicketUtils.newObjectParameter(repositoryName, objectId)));
	add(new BookmarkablePageLink<Void>("commitDiffLink", CommitDiffPage.class,
			WicketUtils.newObjectParameter(repositoryName, objectId)));

	// diff page links
	add(new BookmarkablePageLink<Void>("blameLink", BlamePage.class,
			WicketUtils.newPathParameter(repositoryName, objectId, blobPath)));
	add(new BookmarkablePageLink<Void>("historyLink", HistoryPage.class,
			WicketUtils.newPathParameter(repositoryName, objectId, blobPath)));

	add(new CommitHeaderPanel("commitHeader", repositoryName, commit));

	add(new PathBreadcrumbsPanel("breadcrumbs", repositoryName, blobPath, objectId));

	add(new Label("diffText", diff).setEscapeModelStrings(false));
}
 
開發者ID:warpfork,項目名稱:gitblit,代碼行數:45,代碼來源:BlobDiffPage.java


注:本文中的com.gitblit.wicket.WicketUtils.getPath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。