當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。