本文整理匯總了Java中com.gitblit.wicket.WicketUtils類的典型用法代碼示例。如果您正苦於以下問題:Java WicketUtils類的具體用法?Java WicketUtils怎麽用?Java WicketUtils使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
WicketUtils類屬於com.gitblit.wicket包,在下文中一共展示了WicketUtils類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addUserAttributions
import com.gitblit.wicket.WicketUtils; //導入依賴的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)));
}
}
示例2: setChangeTypeTooltip
import com.gitblit.wicket.WicketUtils; //導入依賴的package包/類
protected void setChangeTypeTooltip(Component container, ChangeType type) {
switch (type) {
case ADD:
WicketUtils.setHtmlTooltip(container, getString("gb.addition"));
break;
case COPY:
case RENAME:
WicketUtils.setHtmlTooltip(container, getString("gb.rename"));
break;
case DELETE:
WicketUtils.setHtmlTooltip(container, getString("gb.deletion"));
break;
case MODIFY:
WicketUtils.setHtmlTooltip(container, getString("gb.modification"));
break;
}
}
示例3: insertLinePlot
import com.gitblit.wicket.WicketUtils; //導入依賴的package包/類
private void insertLinePlot(String wicketId, List<Metric> metrics) {
if ((metrics != null) && (metrics.size() > 0)) {
IChartData data = WicketUtils.getChartData(metrics);
ChartProvider provider = new ChartProvider(new Dimension(400, 100), ChartType.LINE,
data);
ChartAxis dateAxis = new ChartAxis(ChartAxisType.BOTTOM);
dateAxis.setLabels(new String[] { metrics.get(0).name,
metrics.get(metrics.size() / 2).name, metrics.get(metrics.size() - 1).name });
provider.addAxis(dateAxis);
ChartAxis commitAxis = new ChartAxis(ChartAxisType.LEFT);
commitAxis.setLabels(new String[] { "",
String.valueOf((int) WicketUtils.maxValue(metrics)) });
provider.addAxis(commitAxis);
provider.setLineStyles(new LineStyle[] { new LineStyle(2, 4, 0), new LineStyle(0, 4, 1) });
provider.addShapeMarker(new ShapeMarker(MarkerType.CIRCLE, Color.decode("#002060"), 1, -1, 5));
add(new Chart(wicketId, provider));
} else {
add(WicketUtils.newBlankImage(wicketId));
}
}
示例4: insertBarPlot
import com.gitblit.wicket.WicketUtils; //導入依賴的package包/類
private void insertBarPlot(String wicketId, List<Metric> metrics) {
if ((metrics != null) && (metrics.size() > 0)) {
IChartData data = WicketUtils.getChartData(metrics);
ChartProvider provider = new ChartProvider(new Dimension(400, 100),
ChartType.BAR_VERTICAL_SET, data);
ChartAxis dateAxis = new ChartAxis(ChartAxisType.BOTTOM);
List<String> labels = new ArrayList<String>();
for (Metric metric : metrics) {
labels.add(metric.name);
}
dateAxis.setLabels(labels.toArray(new String[labels.size()]));
provider.addAxis(dateAxis);
ChartAxis commitAxis = new ChartAxis(ChartAxisType.LEFT);
commitAxis.setLabels(new String[] { "",
String.valueOf((int) WicketUtils.maxValue(metrics)) });
provider.addAxis(commitAxis);
add(new Chart(wicketId, provider));
} else {
add(WicketUtils.newBlankImage(wicketId));
}
}
示例5: GravatarImage
import com.gitblit.wicket.WicketUtils; //導入依賴的package包/類
public GravatarImage(String id, PersonIdent person, int width, boolean linked) {
super(id);
String email = person.getEmailAddress() == null ? person.getName().toLowerCase() : person.getEmailAddress().toLowerCase();
String hash = StringUtils.getMD5(email);
Link<Void> link = new BookmarkablePageLink<Void>("link", GravatarProfilePage.class,
WicketUtils.newObjectParameter(hash));
link.add(new SimpleAttributeModifier("target", "_blank"));
String url = ActivityUtils.getGravatarThumbnailUrl(email, width);
ExternalImage image = new ExternalImage("image", url);
WicketUtils.setCssClass(image, "gravatar");
link.add(image);
if (linked) {
WicketUtils.setHtmlTooltip(link,
MessageFormat.format("View Gravatar profile for {0}", person.getName()));
} else {
WicketUtils.setHtmlTooltip(link, person.getName());
}
add(link.setEnabled(linked));
setVisible(GitBlit.getBoolean(Keys.web.allowGravatar, true));
}
示例6: insertActivityGraph
import com.gitblit.wicket.WicketUtils; //導入依賴的package包/類
private void insertActivityGraph(List<Metric> metrics) {
if ((metrics != null) && (metrics.size() > 0)
&& GitBlit.getBoolean(Keys.web.generateActivityGraph, true)) {
IChartData data = WicketUtils.getChartData(metrics);
ChartProvider provider = new ChartProvider(new Dimension(290, 100), ChartType.LINE,
data);
ChartAxis dateAxis = new ChartAxis(ChartAxisType.BOTTOM);
dateAxis.setLabels(new String[] { metrics.get(0).name,
metrics.get(metrics.size() / 2).name, metrics.get(metrics.size() - 1).name });
provider.addAxis(dateAxis);
ChartAxis commitAxis = new ChartAxis(ChartAxisType.LEFT);
commitAxis.setLabels(new String[] { "",
String.valueOf((int) WicketUtils.maxValue(metrics)) });
provider.addAxis(commitAxis);
provider.setLineStyles(new LineStyle[] { new LineStyle(2, 4, 0), new LineStyle(0, 4, 1) });
provider.addShapeMarker(new ShapeMarker(MarkerType.CIRCLE, Color.decode("#002060"), 1, -1, 5));
add(new Chart("commitsChart", provider));
} else {
add(WicketUtils.newBlankImage("commitsChart"));
}
}
示例7: PushesPage
import com.gitblit.wicket.WicketUtils; //導入依賴的package包/類
public PushesPage(PageParameters params) {
super(params);
addSyndicationDiscoveryLink();
int pageNumber = WicketUtils.getPage(params);
int prevPage = Math.max(0, pageNumber - 1);
int nextPage = pageNumber + 1;
PushesPanel pushesPanel = new PushesPanel("pushesPanel", getRepositoryModel(), getRepository(), -1,
pageNumber - 1, false);
boolean hasMore = pushesPanel.hasMore();
add(pushesPanel);
add(new BookmarkablePageLink<Void>("firstPage", PushesPage.class,
WicketUtils.newObjectParameter(repositoryName, objectId))
.setEnabled(pageNumber > 1));
add(new BookmarkablePageLink<Void>("prevPage", PushesPage.class,
WicketUtils.newLogPageParameter(repositoryName, objectId, prevPage))
.setEnabled(pageNumber > 1));
add(new BookmarkablePageLink<Void>("nextPage", PushesPage.class,
WicketUtils.newLogPageParameter(repositoryName, objectId, nextPage))
.setEnabled(hasMore));
}
示例8: setupPage
import com.gitblit.wicket.WicketUtils; //導入依賴的package包/類
protected void setupPage(String repositoryName, String pageName) {
String siteName = GitBlit.getString(Keys.web.siteName, Constants.NAME);
if (StringUtils.isEmpty(siteName)) {
siteName = Constants.NAME;
}
if (repositoryName != null && repositoryName.trim().length() > 0) {
add(new Label("title", repositoryName + " - " + siteName));
} else {
add(new Label("title", siteName));
}
ExternalLink rootLink = new ExternalLink("rootLink", urlFor(GitBlitWebApp.HOME_PAGE_CLASS, null).toString());
WicketUtils.setHtmlTooltip(rootLink, GitBlit.getString(Keys.web.siteName, Constants.NAME));
add(rootLink);
// Feedback panel for info, warning, and non-fatal error messages
add(new FeedbackPanel("feedback"));
add(new Label("gbVersion", "v" + Constants.getVersion()));
if (GitBlit.getBoolean(Keys.web.aggressiveHeapManagement, false)) {
System.gc();
}
}
示例9: LinkPanel
import com.gitblit.wicket.WicketUtils; //導入依賴的package包/類
public LinkPanel(String wicketId, String bootstrapIcon, String linkCssClass, IModel<String> model,
Class<? extends WebPage> clazz, PageParameters parameters, boolean newWindow) {
super(wicketId);
this.labelModel = model;
Link<Void> link = null;
if (parameters == null) {
link = new BookmarkablePageLink<Void>("link", clazz);
} else {
link = new BookmarkablePageLink<Void>("link", clazz, parameters);
}
if (newWindow) {
link.add(new SimpleAttributeModifier("target", "_blank"));
}
if (linkCssClass != null) {
link.add(new SimpleAttributeModifier("class", linkCssClass));
}
Label icon = new Label("icon");
if (StringUtils.isEmpty(bootstrapIcon)) {
link.add(icon.setVisible(false));
} else {
WicketUtils.setCssClass(icon, bootstrapIcon);
link.add(icon);
}
link.add(new Label("label", labelModel).setRenderBodyOnly(true));
add(link);
}
示例10: insertLinePlot
import com.gitblit.wicket.WicketUtils; //導入依賴的package包/類
private void insertLinePlot(String wicketId, List<Metric> metrics) {
if ((metrics != null) && (metrics.size() > 0)) {
IChartData data = WicketUtils.getChartData(metrics);
ChartProvider provider = new ChartProvider(new Dimension(400, 100), ChartType.LINE,
data);
ChartAxis dateAxis = new ChartAxis(ChartAxisType.BOTTOM);
dateAxis.setLabels(new String[] { metrics.get(0).name,
metrics.get(metrics.size() / 2).name, metrics.get(metrics.size() - 1).name });
provider.addAxis(dateAxis);
ChartAxis commitAxis = new ChartAxis(ChartAxisType.LEFT);
commitAxis.setLabels(new String[] { "",
String.valueOf((int) WicketUtils.maxValue(metrics)) });
provider.addAxis(commitAxis);
provider.setLineStyles(new LineStyle[] { new LineStyle(2, 4, 0), new LineStyle(0, 4, 1) });
provider.addShapeMarker(new ShapeMarker(MarkerType.CIRCLE, Color.BLUE, 1, -1, 5));
add(new Chart(wicketId, provider));
} else {
add(WicketUtils.newBlankImage(wicketId));
}
}
示例11: insertActivityGraph
import com.gitblit.wicket.WicketUtils; //導入依賴的package包/類
private void insertActivityGraph(List<Metric> metrics) {
if ((metrics != null) && (metrics.size() > 0)
&& GitBlit.getBoolean(Keys.web.generateActivityGraph, true)) {
IChartData data = WicketUtils.getChartData(metrics);
ChartProvider provider = new ChartProvider(new Dimension(290, 100), ChartType.LINE,
data);
ChartAxis dateAxis = new ChartAxis(ChartAxisType.BOTTOM);
dateAxis.setLabels(new String[] { metrics.get(0).name,
metrics.get(metrics.size() / 2).name, metrics.get(metrics.size() - 1).name });
provider.addAxis(dateAxis);
ChartAxis commitAxis = new ChartAxis(ChartAxisType.LEFT);
commitAxis.setLabels(new String[] { "",
String.valueOf((int) WicketUtils.maxValue(metrics)) });
provider.addAxis(commitAxis);
provider.setLineStyles(new LineStyle[] { new LineStyle(2, 4, 0), new LineStyle(0, 4, 1) });
provider.addShapeMarker(new ShapeMarker(MarkerType.CIRCLE, Color.BLUE, 1, -1, 5));
add(new Chart("commitsChart", provider));
} else {
add(WicketUtils.newBlankImage("commitsChart"));
}
}
示例12: GravatarProfilePage
import com.gitblit.wicket.WicketUtils; //導入依賴的package包/類
public GravatarProfilePage(PageParameters params) {
super();
setupPage("", "");
String object = WicketUtils.getObject(params);
GravatarProfile profile = null;
try {
if (object.indexOf('@') > -1) {
profile = ActivityUtils.getGravatarProfileFromAddress(object);
} else {
profile = ActivityUtils.getGravatarProfile(object);
}
} catch (IOException e) {
error(MessageFormat.format(getString("gb.failedToFindGravatarProfile"), object), e, true);
}
if (profile == null) {
error(MessageFormat.format(getString("gb.failedToFindGravatarProfile"), object), true);
}
add(new Label("displayName", profile.displayName));
add(new Label("username", profile.preferredUsername));
add(new Label("location", profile.currentLocation));
add(new Label("aboutMe", profile.aboutMe));
ExternalImage image = new ExternalImage("profileImage", profile.thumbnailUrl + "?s=256&d=identicon");
add(image);
add(new ExternalLink("profileLink", profile.profileUrl));
}
示例13: MetricsPage
import com.gitblit.wicket.WicketUtils; //導入依賴的package包/類
public MetricsPage(PageParameters params) {
super(params);
Repository r = getRepository();
if (StringUtils.isEmpty(objectId)) {
add(new Label("branchTitle", getRepositoryModel().HEAD));
} else {
add(new Label("branchTitle", objectId));
}
Metric metricsTotal = null;
List<Metric> metrics = MetricUtils.getDateMetrics(r, objectId, true, null, getTimeZone());
metricsTotal = metrics.remove(0);
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))));
}
Charts charts = new Flotr2Charts();
add(WicketUtils.newBlankImage("commitsChart"));
add(WicketUtils.newBlankImage("dayOfWeekChart"));
add(WicketUtils.newBlankImage("authorsChart"));
createLineChart(charts, "commitsChart", metrics);
createBarChart(charts, "dayOfWeekChart", getDayOfWeekMetrics(r, objectId));
createPieChart(charts, "authorsChart", getAuthorMetrics(r, objectId));
add(new HeaderContributor(charts));
}
示例14: addDateAttributions
import com.gitblit.wicket.WicketUtils; //導入依賴的package包/類
protected void addDateAttributions(MarkupContainer container, Change entry) {
container.add(WicketUtils.createDateLabel("changeDate", entry.date, GitBlitWebSession
.get().getTimezone(), getTimeUtils(), false));
// set the id attribute
if (entry.hasComment()) {
container.setOutputMarkupId(true);
container.add(new AttributeModifier("id", Model.of(entry.getId())));
ExternalLink link = new ExternalLink("changeLink", "#" + entry.getId());
container.add(link);
} else {
container.add(new Label("changeLink").setVisible(false));
}
}
示例15: LoginForm
import com.gitblit.wicket.WicketUtils; //導入依賴的package包/類
public LoginForm(String id, String markupId, MarkupContainer markupProvider) {
super(id, markupId, markupProvider);
setRenderBodyOnly(true);
SessionlessForm<Void> loginForm = new SessionlessForm<Void>("loginForm", RootPage.this.getClass(), getPageParameters()) {
private static final long serialVersionUID = 1L;
@Override
public void onSubmit() {
String username = RootPage.this.username.getObject();
char[] password = RootPage.this.password.getObject().toCharArray();
HttpServletRequest request = ((WebRequest) RequestCycle.get().getRequest()).getHttpServletRequest();
UserModel user = app().authentication().authenticate(username, password, request.getRemoteAddr());
if (user == null) {
error(getString("gb.invalidUsernameOrPassword"));
} else if (user.username.equals(Constants.FEDERATION_USER)) {
// disallow the federation user from logging in via the
// web ui
error(getString("gb.invalidUsernameOrPassword"));
user = null;
} else {
loginUser(user);
}
}
};
TextField<String> unameField = new TextField<String>("username", username);
WicketUtils.setInputPlaceholder(unameField, markupProvider.getString("gb.username"));
loginForm.add(unameField);
NonTrimmedPasswordTextField pwField = new NonTrimmedPasswordTextField("password", password);
WicketUtils.setInputPlaceholder(pwField, markupProvider.getString("gb.password"));
loginForm.add(pwField);
add(loginForm);
}