本文整理汇总了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)));
}
示例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)));
}
示例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);
}