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


Java RepositoryUrlPanel類代碼示例

本文整理匯總了Java中com.gitblit.wicket.panels.RepositoryUrlPanel的典型用法代碼示例。如果您正苦於以下問題:Java RepositoryUrlPanel類的具體用法?Java RepositoryUrlPanel怎麽用?Java RepositoryUrlPanel使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: EmptyRepositoryPage

import com.gitblit.wicket.panels.RepositoryUrlPanel; //導入依賴的package包/類
public EmptyRepositoryPage(PageParameters params) {
	super(params);

	setVersioned(false);

	String repositoryName = WicketUtils.getRepositoryName(params);
	RepositoryModel repository = GitBlit.self().getRepositoryModel(repositoryName);
	if (repository == null) {
		error(getString("gb.canNotLoadRepository") + " " + repositoryName, true);
	}
	
	if (repository.hasCommits) {
		// redirect to the summary page if this repository is not empty
		throw new GitblitRedirectException(SummaryPage.class, params);
	}
	
	setupPage(repositoryName, getString("gb.emptyRepository"));

	UserModel user = GitBlitWebSession.get().getUser();
	if (user == null) {
		user = UserModel.ANONYMOUS;
	}
	
	RepositoryUrlPanel urlPanel = new RepositoryUrlPanel("pushurl", false, user, repository);
	String primaryUrl = urlPanel.getPrimaryUrl();
	
	add(new Label("repository", repositoryName));
	add(urlPanel);
	add(new Label("cloneSyntax", MessageFormat.format("git clone {0}", primaryUrl)));
	add(new Label("remoteSyntax", MessageFormat.format("git remote add gitblit {0}\ngit push gitblit master", primaryUrl)));
}
 
開發者ID:warpfork,項目名稱:gitblit,代碼行數:32,代碼來源:EmptyRepositoryPage.java

示例2: EmptyRepositoryPage

import com.gitblit.wicket.panels.RepositoryUrlPanel; //導入依賴的package包/類
public EmptyRepositoryPage(PageParameters params) {
	super(params);

	setVersioned(false);

	String repositoryName = WicketUtils.getRepositoryName(params);
	RepositoryModel repository = GitBlit.self().getRepositoryModel(repositoryName);
	if (repository == null) {
		error(getString("gb.canNotLoadRepository") + " " + repositoryName, true);
	}
	
	if (repository.hasCommits) {
		// redirect to the summary page if this repository is not empty
		throw new GitblitRedirectException(SummaryPage.class, params);
	}
	
	setupPage(repositoryName, getString("gb.emptyRepository"));

	List<String> repositoryUrls = new ArrayList<String>();

	if (GitBlit.getBoolean(Keys.git.enableGitServlet, true)) {
		// add the Gitblit repository url
		repositoryUrls.add(getRepositoryUrl(repository));
	}
	UserModel user = GitBlitWebSession.get().getUser();
	repositoryUrls.addAll(GitBlit.self().getOtherCloneUrls(repositoryName, user == null ? "" : user.username));
	
	String primaryUrl = ArrayUtils.isEmpty(repositoryUrls) ? "" : repositoryUrls.get(0);
	add(new Label("repository", repositoryName));
	add(new RepositoryUrlPanel("pushurl", primaryUrl));
	add(new Label("cloneSyntax", MessageFormat.format("git clone {0}", repositoryUrls.get(0))));
	add(new Label("remoteSyntax", MessageFormat.format("git remote add gitblit {0}\ngit push gitblit master", primaryUrl)));
}
 
開發者ID:BullShark,項目名稱:IRCBlit,代碼行數:34,代碼來源:EmptyRepositoryPage.java

示例3: OverviewPage

import com.gitblit.wicket.panels.RepositoryUrlPanel; //導入依賴的package包/類
public OverviewPage(PageParameters params) {
	super(params);

	int numberRefs = GitBlit.getInteger(Keys.web.summaryRefsCount, 5);

	Repository r = getRepository();
	final RepositoryModel model = getRepositoryModel();
	UserModel user = GitBlitWebSession.get().getUser();
	if (user == null) {
		user = UserModel.ANONYMOUS;
	}

	List<Metric> metrics = null;
	Metric metricsTotal = null;
	if (!model.skipSummaryMetrics && GitBlit.getBoolean(Keys.web.generateActivityGraph, true)) {
		metrics = GitBlit.self().getRepositoryDefaultMetrics(model, r);
		metricsTotal = metrics.remove(0);
	}

	addSyndicationDiscoveryLink();

	// repository description
	add(new Label("repositoryDescription", getRepositoryModel().description));
	
	// owner links
	final List<String> owners = new ArrayList<String>(getRepositoryModel().owners);
	ListDataProvider<String> ownersDp = new ListDataProvider<String>(owners);
	DataView<String> ownersView = new DataView<String>("repositoryOwners", ownersDp) {
		private static final long serialVersionUID = 1L;
		int counter = 0;
		public void populateItem(final Item<String> item) {
			UserModel ownerModel = GitBlit.self().getUserModel(item.getModelObject());
			if (ownerModel != null) {
				item.add(new LinkPanel("owner", null, ownerModel.getDisplayName(), UserPage.class,
						WicketUtils.newUsernameParameter(ownerModel.username)).setRenderBodyOnly(true));
			} else {
				item.add(new Label("owner").setVisible(false));
			}
			counter++;
			item.add(new Label("comma", ",").setVisible(counter < owners.size()));
			item.setRenderBodyOnly(true);
		}
	};
	ownersView.setRenderBodyOnly(true);
	add(ownersView);
	
	add(WicketUtils.createTimestampLabel("repositoryLastChange",
			JGitUtils.getLastChange(r), getTimeZone(), getTimeUtils()));
	add(new Label("repositorySize", model.size));
	
	if (metricsTotal == null) {
		add(new Label("branchStats", ""));
	} else {
		add(new Label("branchStats",
				MessageFormat.format(getString("gb.branchStats"), metricsTotal.count,
						metricsTotal.tag, getTimeUtils().duration(metricsTotal.duration))));
	}
	add(new BookmarkablePageLink<Void>("metrics", MetricsPage.class,
			WicketUtils.newRepositoryParameter(repositoryName)));

	add(new RepositoryUrlPanel("repositoryUrlPanel", false, user, model));

	int pushCount = GitBlit.getInteger(Keys.web.overviewPushCount, 5);
	PushesPanel pushes = new PushesPanel("pushesPanel", getRepositoryModel(), r, pushCount, 0, false);
	add(pushes);
	add(new TagsPanel("tagsPanel", repositoryName, r, numberRefs).hideIfEmpty());
	add(new BranchesPanel("branchesPanel", getRepositoryModel(), r, numberRefs, false).hideIfEmpty());

	// Display an activity line graph
	insertActivityGraph(metrics);
}
 
開發者ID:warpfork,項目名稱:gitblit,代碼行數:72,代碼來源:OverviewPage.java


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