当前位置: 首页>>代码示例>>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;未经允许,请勿转载。