当前位置: 首页>>代码示例>>Java>>正文


Java LinkPanel类代码示例

本文整理汇总了Java中com.gitblit.wicket.panels.LinkPanel的典型用法代码示例。如果您正苦于以下问题:Java LinkPanel类的具体用法?Java LinkPanel怎么用?Java LinkPanel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LinkPanel类属于com.gitblit.wicket.panels包,在下文中一共展示了LinkPanel类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addUserAttributions

import com.gitblit.wicket.panels.LinkPanel; //导入依赖的package包/类
protected void addUserAttributions(MarkupContainer container, Change entry, int avatarSize) {
	UserModel commenter = app().users().getUserModel(entry.author);
	if (commenter == null) {
		// unknown user
		container.add(new AvatarImage("changeAvatar", entry.author,
				entry.author, null, avatarSize, false).setVisible(avatarSize > 0));
		container.add(new Label("changeAuthor", entry.author.toLowerCase()));
	} else {
		// known user
		container.add(new AvatarImage("changeAvatar", commenter.getDisplayName(),
				commenter.emailAddress, avatarSize > 24 ? "gravatar-round" : null,
						avatarSize, true).setVisible(avatarSize > 0));
		container.add(new LinkPanel("changeAuthor", null, commenter.getDisplayName(),
				UserPage.class, WicketUtils.newUsernameParameter(commenter.username)));
	}
}
 
开发者ID:tomaswolf,项目名称:gerrit-gitblit-plugin,代码行数:17,代码来源:TicketPage.java

示例2: UserFragment

import com.gitblit.wicket.panels.LinkPanel; //导入依赖的package包/类
public UserFragment(String id, String markupId, MarkupContainer markupProvider) {
	super(id, markupId, markupProvider);

	GitBlitWebSession session = GitBlitWebSession.get();
	if (session.isLoggedIn()) {				
		UserModel user = session.getUser();
		boolean editCredentials = GitBlit.self().supportsCredentialChanges(user);
		boolean standardLogin = session.authenticationType.isStandard();

		// username, logout, and change password
		add(new Label("username", user.getDisplayName() + ":"));
		add(new LinkPanel("loginLink", null, markupProvider.getString("gb.logout"),
				LogoutPage.class).setVisible(standardLogin));
		
		// quick and dirty hack for showing a separator
		add(new Label("separator", "|").setVisible(standardLogin && editCredentials));
		add(new BookmarkablePageLink<Void>("changePasswordLink", 
				ChangePasswordPage.class).setVisible(editCredentials));
	} else {
		// login
		add(new Label("username").setVisible(false));
		add(new Label("loginLink").setVisible(false));
		add(new Label("separator").setVisible(false));
		add(new Label("changePasswordLink").setVisible(false));
	}
}
 
开发者ID:BullShark,项目名称:IRCBlit,代码行数:27,代码来源:BasePage.java

示例3: newSubmenu

import com.gitblit.wicket.panels.LinkPanel; //导入依赖的package包/类
/**
 * Creates a submenu. This is not actually submenu because we're using an older Twitter Bootstrap which is pre-submenu.
 * 
 * @param wicketId
 * @param submenuTitle
 * @param menuItems
 * @return a submenu fragment
 */
private Fragment newSubmenu(String wicketId, String submenuTitle, List<MenuItem> menuItems) {
	Fragment submenu = new Fragment(wicketId, "submenuFragment", this);
	submenu.add(new Label("submenuTitle", submenuTitle).setRenderBodyOnly(true));
	ListDataProvider<MenuItem> menuItemsDp = new ListDataProvider<MenuItem>(menuItems);
	DataView<MenuItem> submenuItems = new DataView<MenuItem>("submenuItem", menuItemsDp) {
		private static final long serialVersionUID = 1L;

		@Override
		public void populateItem(final Item<MenuItem> menuItem) {
			final MenuItem item = menuItem.getModelObject();
			String name = item.toString();
			try {
				// try to lookup translation
				name = getString(name);
			} catch (Exception e) {
			}
			if (item instanceof PageLinkMenuItem) {
				// link to another Wicket page
				PageLinkMenuItem pageLink = (PageLinkMenuItem) item;
				menuItem.add(new LinkPanel("submenuLink", null, null, name, pageLink.getPageClass(), pageLink.getPageParameters(), false)
						.setRenderBodyOnly(true));
			} else if (item instanceof ExternalLinkMenuItem) {
				// link to a specified href
				ExternalLinkMenuItem extLink = (ExternalLinkMenuItem) item;
				menuItem.add(new LinkPanel("submenuLink", null, name, extLink.getHref(), extLink.openInNewWindow()).setRenderBodyOnly(true));
			} else if (item instanceof MenuDivider) {
				// divider
				menuItem.add(new Label("submenuLink").setRenderBodyOnly(true));
				WicketUtils.setCssClass(menuItem, "divider");
			}
		}
	};
	submenu.add(submenuItems);
	submenu.setRenderBodyOnly(true);
	return submenu;
}
 
开发者ID:tomaswolf,项目名称:gerrit-gitblit-plugin,代码行数:45,代码来源:RootPage.java

示例4: createPersonPanel

import com.gitblit.wicket.panels.LinkPanel; //导入依赖的package包/类
protected Component createPersonPanel(String wicketId, PersonIdent identity,
		Constants.SearchType searchType) {
	String name = identity == null ? "" : identity.getName();
	String address = identity == null ? "" : identity.getEmailAddress();
	name = StringUtils.removeNewlines(name);
	address = StringUtils.removeNewlines(address);
	boolean showEmail = app().settings().getBoolean(Keys.web.showEmailAddresses, false);
	if (!showEmail || StringUtils.isEmpty(name) || StringUtils.isEmpty(address)) {
		String value = name;
		if (StringUtils.isEmpty(value)) {
			if (showEmail) {
				value = address;
			} else {
				value = getString("gb.missingUsername");
			}
		}
		Fragment partial = new Fragment(wicketId, "partialPersonIdent", this);
		LinkPanel link = new LinkPanel("personName", "list", value, GitSearchPage.class,
				WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType));
		setPersonSearchTooltip(link, value, searchType);
		partial.add(link);
		return partial;
	} else {
		Fragment fullPerson = new Fragment(wicketId, "fullPersonIdent", this);
		LinkPanel nameLink = new LinkPanel("personName", "list", name, GitSearchPage.class,
				WicketUtils.newSearchParameter(repositoryName, objectId, name, searchType));
		setPersonSearchTooltip(nameLink, name, searchType);
		fullPerson.add(nameLink);

		LinkPanel addressLink = new LinkPanel("personAddress", "hidden-phone list", "<" + address + ">",
				GitSearchPage.class, WicketUtils.newSearchParameter(repositoryName, objectId,
						address, searchType));
		setPersonSearchTooltip(addressLink, address, searchType);
		fullPerson.add(addressLink);
		return fullPerson;
	}
}
 
开发者ID:tomaswolf,项目名称:gerrit-gitblit-plugin,代码行数:38,代码来源:RepositoryPage.java

示例5: DocsPage

import com.gitblit.wicket.panels.LinkPanel; //导入依赖的package包/类
public DocsPage(PageParameters params) {
	super(params);

	Repository r = getRepository();
	List<String> extensions = GitBlit.getStrings(Keys.web.markdownExtensions);
	List<PathModel> paths = JGitUtils.getDocuments(r, extensions);

	final ByteFormat byteFormat = new ByteFormat();

	add(new Label("header", getString("gb.docs")));

	// documents list
	ListDataProvider<PathModel> pathsDp = new ListDataProvider<PathModel>(paths);
	DataView<PathModel> pathsView = new DataView<PathModel>("document", pathsDp) {
		private static final long serialVersionUID = 1L;
		int counter;

		public void populateItem(final Item<PathModel> item) {
			PathModel entry = item.getModelObject();
			item.add(WicketUtils.newImage("docIcon", "file_world_16x16.png"));
			item.add(new Label("docSize", byteFormat.format(entry.size)));
			item.add(new LinkPanel("docName", "list", entry.name, BlobPage.class, WicketUtils
					.newPathParameter(repositoryName, entry.commitId, entry.path)));

			// links
			item.add(new BookmarkablePageLink<Void>("view", BlobPage.class, WicketUtils
					.newPathParameter(repositoryName, entry.commitId, entry.path)));
			item.add(new BookmarkablePageLink<Void>("raw", RawPage.class, WicketUtils
					.newPathParameter(repositoryName, entry.commitId, entry.path)));
			item.add(new BookmarkablePageLink<Void>("blame", BlamePage.class, WicketUtils
					.newPathParameter(repositoryName, entry.commitId, entry.path)));
			item.add(new BookmarkablePageLink<Void>("history", HistoryPage.class, WicketUtils
					.newPathParameter(repositoryName, entry.commitId, entry.path)));
			WicketUtils.setAlternatingBackground(item, counter);
			counter++;
		}
	};
	add(pathsView);
}
 
开发者ID:warpfork,项目名称:gitblit,代码行数:40,代码来源:DocsPage.java

示例6: TicketsPage

import com.gitblit.wicket.panels.LinkPanel; //导入依赖的package包/类
public TicketsPage(PageParameters params) {
	super(params);

	List<TicketModel> tickets = TicgitUtils.getTickets(getRepository());

	ListDataProvider<TicketModel> ticketsDp = new ListDataProvider<TicketModel>(tickets);
	DataView<TicketModel> ticketsView = new DataView<TicketModel>("ticket", ticketsDp) {
		private static final long serialVersionUID = 1L;
		int counter;

		public void populateItem(final Item<TicketModel> item) {
			final TicketModel entry = item.getModelObject();
			Label stateLabel = new Label("ticketState", entry.state);
			WicketUtils.setTicketCssClass(stateLabel, entry.state);
			item.add(stateLabel);
			item.add(WicketUtils.createDateLabel("ticketDate", entry.date, GitBlitWebSession
					.get().getTimezone(), getTimeUtils()));
			item.add(new Label("ticketHandler", StringUtils.trimString(
					entry.handler.toLowerCase(), 30)));
			item.add(new LinkPanel("ticketTitle", "list subject", StringUtils.trimString(
					entry.title, 80), TicketPage.class, newPathParameter(entry.name)));

			WicketUtils.setAlternatingBackground(item, counter);
			counter++;
		}
	};
	add(ticketsView);
}
 
开发者ID:warpfork,项目名称:gitblit,代码行数:29,代码来源:TicketsPage.java

示例7: createPersonPanel

import com.gitblit.wicket.panels.LinkPanel; //导入依赖的package包/类
protected Component createPersonPanel(String wicketId, PersonIdent identity,
		Constants.SearchType searchType) {
	String name = identity == null ? "" : identity.getName();
	String address = identity == null ? "" : identity.getEmailAddress();
	name = StringUtils.removeNewlines(name);
	address = StringUtils.removeNewlines(address);
	boolean showEmail = GitBlit.getBoolean(Keys.web.showEmailAddresses, false);
	if (!showEmail || StringUtils.isEmpty(name) || StringUtils.isEmpty(address)) {
		String value = name;
		if (StringUtils.isEmpty(value)) {
			if (showEmail) {
				value = address;
			} else {
				value = getString("gb.missingUsername");
			}
		}
		Fragment partial = new Fragment(wicketId, "partialPersonIdent", this);
		LinkPanel link = new LinkPanel("personName", "list", value, GitSearchPage.class,
				WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType));
		setPersonSearchTooltip(link, value, searchType);
		partial.add(link);
		return partial;
	} else {
		Fragment fullPerson = new Fragment(wicketId, "fullPersonIdent", this);
		LinkPanel nameLink = new LinkPanel("personName", "list", name, GitSearchPage.class,
				WicketUtils.newSearchParameter(repositoryName, objectId, name, searchType));
		setPersonSearchTooltip(nameLink, name, searchType);
		fullPerson.add(nameLink);

		LinkPanel addressLink = new LinkPanel("personAddress", "hidden-phone list", "<" + address + ">",
				GitSearchPage.class, WicketUtils.newSearchParameter(repositoryName, objectId,
						address, searchType));
		setPersonSearchTooltip(addressLink, address, searchType);
		fullPerson.add(addressLink);
		return fullPerson;
	}
}
 
开发者ID:warpfork,项目名称:gitblit,代码行数:38,代码来源:RepositoryPage.java

示例8: TicketsPage

import com.gitblit.wicket.panels.LinkPanel; //导入依赖的package包/类
public TicketsPage(PageParameters params) {
	super(params);

	List<TicketModel> tickets = TicgitUtils.getTickets(getRepository());

	// header
	add(new LinkPanel("header", "title", repositoryName, SummaryPage.class,
			newRepositoryParameter()));

	ListDataProvider<TicketModel> ticketsDp = new ListDataProvider<TicketModel>(tickets);
	DataView<TicketModel> ticketsView = new DataView<TicketModel>("ticket", ticketsDp) {
		private static final long serialVersionUID = 1L;
		int counter;

		public void populateItem(final Item<TicketModel> item) {
			final TicketModel entry = item.getModelObject();
			Label stateLabel = new Label("ticketState", entry.state);
			WicketUtils.setTicketCssClass(stateLabel, entry.state);
			item.add(stateLabel);
			item.add(WicketUtils.createDateLabel("ticketDate", entry.date, GitBlitWebSession
					.get().getTimezone(), getTimeUtils()));
			item.add(new Label("ticketHandler", StringUtils.trimString(
					entry.handler.toLowerCase(), 30)));
			item.add(new LinkPanel("ticketTitle", "list subject", StringUtils.trimString(
					entry.title, 80), TicketPage.class, newPathParameter(entry.name)));

			WicketUtils.setAlternatingBackground(item, counter);
			counter++;
		}
	};
	add(ticketsView);
}
 
开发者ID:BullShark,项目名称:IRCBlit,代码行数:33,代码来源:TicketsPage.java

示例9: OverviewPage

import com.gitblit.wicket.panels.LinkPanel; //导入依赖的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

示例10: TagPage

import com.gitblit.wicket.panels.LinkPanel; //导入依赖的package包/类
public TagPage(PageParameters params) {
	super(params);

	Repository r = getRepository();

	// Find tag in repository
	List<RefModel> tags = JGitUtils.getTags(r, true, -1);
	RefModel tagRef = null;
	for (RefModel tag : tags) {
		if (tag.getName().equals(objectId) || tag.getObjectId().getName().equals(objectId)) {
			tagRef = tag;
			break;
		}
	}

	// Failed to find tag!
	if (tagRef == null) {
		error(MessageFormat.format(getString("gb.couldNotFindTag"), objectId), true);
	}

	// Display tag.
	Class<? extends WebPage> linkClass;
	PageParameters linkParameters = newCommitParameter(tagRef.getReferencedObjectId().getName());
	String typeKey;
	switch (tagRef.getReferencedObjectType()) {
	case Constants.OBJ_BLOB:
		typeKey = "gb.blob";
		linkClass = BlobPage.class;
		break;
	case Constants.OBJ_TREE:
		typeKey = "gb.tree";
		linkClass = TreePage.class;
		break;
	case Constants.OBJ_COMMIT:
	default:
		typeKey = "gb.commit";
		linkClass = CommitPage.class;
		break;
	}
	add(new GravatarImage("taggerAvatar", tagRef.getAuthorIdent()));
	
	add(new RefsPanel("tagName", repositoryName, Arrays.asList(tagRef)));
	add(new Label("tagId", tagRef.getObjectId().getName()));
	add(new LinkPanel("taggedObject", "list", tagRef.getReferencedObjectId().getName(),
			linkClass, linkParameters));
	add(new Label("taggedObjectType", getString(typeKey)));

	add(createPersonPanel("tagger", tagRef.getAuthorIdent(), com.gitblit.Constants.SearchType.AUTHOR));
	Date when = new Date(0);
	if (tagRef.getAuthorIdent() != null) {
		when = tagRef.getAuthorIdent().getWhen();
	}
	add(WicketUtils.createTimestampLabel("tagDate", when, getTimeZone(), getTimeUtils()));

	addFullText("fullMessage", tagRef.getFullMessage(), true);
}
 
开发者ID:warpfork,项目名称:gitblit,代码行数:57,代码来源:TagPage.java

示例11: TagPage

import com.gitblit.wicket.panels.LinkPanel; //导入依赖的package包/类
public TagPage(PageParameters params) {
	super(params);

	Repository r = getRepository();

	// Find tag in repository
	List<RefModel> tags = JGitUtils.getTags(r, true, -1);
	RefModel tagRef = null;
	for (RefModel tag : tags) {
		if (tag.getName().equals(objectId) || tag.getObjectId().getName().equals(objectId)) {
			tagRef = tag;
			break;
		}
	}

	// Failed to find tag!
	if (tagRef == null) {
		error(MessageFormat.format(getString("gb.couldNotFindTag"), objectId), true);
	}

	// Display tag.
	Class<? extends RepositoryPage> linkClass;
	PageParameters linkParameters = newCommitParameter(tagRef.getReferencedObjectId().getName());
	String typeKey;
	switch (tagRef.getReferencedObjectType()) {
	case Constants.OBJ_BLOB:
		typeKey = "gb.blob";
		linkClass = BlobPage.class;
		break;
	case Constants.OBJ_TREE:
		typeKey = "gb.tree";
		linkClass = TreePage.class;
		break;
	case Constants.OBJ_COMMIT:
	default:
		typeKey = "gb.commit";
		linkClass = CommitPage.class;
		break;
	}
	add(new LinkPanel("commit", "title", tagRef.displayName, linkClass, linkParameters));
	add(new GravatarImage("taggerAvatar", tagRef.getAuthorIdent()));
	
	add(new RefsPanel("tagName", repositoryName, Arrays.asList(tagRef)));
	add(new Label("tagId", tagRef.getObjectId().getName()));
	add(new LinkPanel("taggedObject", "list", tagRef.getReferencedObjectId().getName(),
			linkClass, linkParameters));
	add(new Label("taggedObjectType", getString(typeKey)));

	add(createPersonPanel("tagger", tagRef.getAuthorIdent(), com.gitblit.Constants.SearchType.AUTHOR));
	Date when = new Date(0);
	if (tagRef.getAuthorIdent() != null) {
		when = tagRef.getAuthorIdent().getWhen();
	}
	add(WicketUtils.createTimestampLabel("tagDate", when, getTimeZone(), getTimeUtils()));

	addFullText("fullMessage", tagRef.getFullMessage(), true);
}
 
开发者ID:BullShark,项目名称:IRCBlit,代码行数:58,代码来源:TagPage.java


注:本文中的com.gitblit.wicket.panels.LinkPanel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。