本文整理匯總了Java中com.gitblit.wicket.WicketUtils.setAlternatingBackground方法的典型用法代碼示例。如果您正苦於以下問題:Java WicketUtils.setAlternatingBackground方法的具體用法?Java WicketUtils.setAlternatingBackground怎麽用?Java WicketUtils.setAlternatingBackground使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.gitblit.wicket.WicketUtils
的用法示例。
在下文中一共展示了WicketUtils.setAlternatingBackground方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: TicketPage
import com.gitblit.wicket.WicketUtils; //導入方法依賴的package包/類
public TicketPage(PageParameters params) {
super(params);
final String ticketFolder = WicketUtils.getPath(params);
Repository r = getRepository();
TicketModel t = TicgitUtils.getTicket(r, ticketFolder);
add(new Label("ticketTitle", t.title));
add(new Label("ticketId", t.id));
add(new Label("ticketHandler", t.handler.toLowerCase()));
add(WicketUtils.createTimestampLabel("ticketOpenDate", t.date, getTimeZone(), getTimeUtils()));
Label stateLabel = new Label("ticketState", t.state);
WicketUtils.setTicketCssClass(stateLabel, t.state);
add(stateLabel);
add(new Label("ticketTags", StringUtils.flattenStrings(t.tags)));
ListDataProvider<Comment> commentsDp = new ListDataProvider<Comment>(t.comments);
DataView<Comment> commentsView = new DataView<Comment>("comment", commentsDp) {
private static final long serialVersionUID = 1L;
int counter;
public void populateItem(final Item<Comment> item) {
final Comment entry = item.getModelObject();
item.add(WicketUtils.createDateLabel("commentDate", entry.date, GitBlitWebSession
.get().getTimezone(), getTimeUtils()));
item.add(new Label("commentAuthor", entry.author.toLowerCase()));
item.add(new Label("commentText", prepareComment(entry.text))
.setEscapeModelStrings(false));
WicketUtils.setAlternatingBackground(item, counter);
counter++;
}
};
add(commentsView);
}
示例2: DocsPage
import com.gitblit.wicket.WicketUtils; //導入方法依賴的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);
}
示例3: TicketsPage
import com.gitblit.wicket.WicketUtils; //導入方法依賴的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);
}
示例4: FederationRegistrationsPanel
import com.gitblit.wicket.WicketUtils; //導入方法依賴的package包/類
public FederationRegistrationsPanel(String wicketId) {
super(wicketId);
final List<FederationModel> list = new ArrayList<FederationModel>(GitBlit.self()
.getFederationRegistrations());
list.addAll(GitBlit.self().getFederationResultRegistrations());
Collections.sort(list);
hasRegistrations = list.size() > 0;
DataView<FederationModel> dataView = new DataView<FederationModel>("row",
new ListDataProvider<FederationModel>(list)) {
private static final long serialVersionUID = 1L;
private int counter;
@Override
protected void onBeforeRender() {
super.onBeforeRender();
counter = 0;
}
public void populateItem(final Item<FederationModel> item) {
final FederationModel entry = item.getModelObject();
item.add(new LinkPanel("url", "list", entry.url, FederationRegistrationPage.class,
WicketUtils.newRegistrationParameter(entry.url, entry.name)));
item.add(WicketUtils.getPullStatusImage("statusIcon", entry.getLowestStatus()));
item.add(new LinkPanel("name", "list", entry.name,
FederationRegistrationPage.class, WicketUtils.newRegistrationParameter(
entry.url, entry.name)));
item.add(WicketUtils.getRegistrationImage("typeIcon", entry, this));
item.add(WicketUtils.createDateLabel("lastPull", entry.lastPull, getTimeZone(), getTimeUtils()));
item.add(WicketUtils
.createTimestampLabel("nextPull", entry.nextPull, getTimeZone(), getTimeUtils()));
item.add(new Label("frequency", entry.frequency));
WicketUtils.setAlternatingBackground(item, counter);
counter++;
}
};
add(dataView);
}
示例5: TicketsPage
import com.gitblit.wicket.WicketUtils; //導入方法依賴的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);
}
示例6: FederationRegistrationPage
import com.gitblit.wicket.WicketUtils; //導入方法依賴的package包/類
public FederationRegistrationPage(PageParameters params) {
super(params);
setStatelessHint(true);
String url = WicketUtils.getUrlParameter(params);
String name = WicketUtils.getNameParameter(params);
FederationModel registration = GitBlit.self().getFederationRegistration(url, name);
if (registration == null) {
error(getString("gb.couldNotFindFederationRegistration"), true);
}
setupPage(registration.isResultData() ? getString("gb.federationResults")
: getString("gb.federationRegistration"), registration.url);
add(new Label("url", registration.url));
add(WicketUtils.getRegistrationImage("typeIcon", registration, this));
add(new Label("frequency", registration.frequency));
add(new Label("folder", registration.folder));
add(new Label("token", showAdmin ? registration.token : "--"));
add(WicketUtils.createTimestampLabel("lastPull", registration.lastPull, getTimeZone(), getTimeUtils()));
add(WicketUtils.createTimestampLabel("nextPull", registration.nextPull, getTimeZone(), getTimeUtils()));
StringBuilder inclusions = new StringBuilder();
for (String inc : registration.inclusions) {
inclusions.append(inc).append("<br/>");
}
StringBuilder exclusions = new StringBuilder();
for (String ex : registration.exclusions) {
exclusions.append(ex).append("<br/>");
}
add(new Label("inclusions", inclusions.toString()).setEscapeModelStrings(false));
add(new Label("exclusions", exclusions.toString()).setEscapeModelStrings(false));
List<RepositoryStatus> list = registration.getStatusList();
Collections.sort(list);
DataView<RepositoryStatus> dataView = new DataView<RepositoryStatus>("row",
new ListDataProvider<RepositoryStatus>(list)) {
private static final long serialVersionUID = 1L;
private int counter;
@Override
protected void onBeforeRender() {
super.onBeforeRender();
counter = 0;
}
public void populateItem(final Item<RepositoryStatus> item) {
final RepositoryStatus entry = item.getModelObject();
item.add(WicketUtils.getPullStatusImage("statusIcon", entry.status));
item.add(new Label("name", entry.name));
item.add(new Label("status", entry.status.name()));
WicketUtils.setAlternatingBackground(item, counter);
counter++;
}
};
add(dataView);
}
示例7: FederationProposalsPanel
import com.gitblit.wicket.WicketUtils; //導入方法依賴的package包/類
public FederationProposalsPanel(String wicketId) {
super(wicketId);
final List<FederationProposal> list = GitBlit.self().getPendingFederationProposals();
hasProposals = list.size() > 0;
DataView<FederationProposal> dataView = new DataView<FederationProposal>("row",
new ListDataProvider<FederationProposal>(list)) {
private static final long serialVersionUID = 1L;
private int counter;
@Override
protected void onBeforeRender() {
super.onBeforeRender();
counter = 0;
}
public void populateItem(final Item<FederationProposal> item) {
final FederationProposal entry = item.getModelObject();
item.add(new LinkPanel("url", "list", entry.url, ReviewProposalPage.class,
WicketUtils.newTokenParameter(entry.token)));
item.add(WicketUtils.createDateLabel("received", entry.received, getTimeZone(), getTimeUtils()));
item.add(new Label("tokenType", entry.tokenType.name()));
item.add(new LinkPanel("token", "list", entry.token, ReviewProposalPage.class,
WicketUtils.newTokenParameter(entry.token)));
Link<Void> deleteLink = new Link<Void>("deleteProposal") {
private static final long serialVersionUID = 1L;
@Override
public void onClick() {
if (GitBlit.self().deletePendingFederationProposal(entry)) {
list.remove(entry);
info(MessageFormat.format("Proposal ''{0}'' deleted.", entry.name));
} else {
error(MessageFormat.format("Failed to delete proposal ''{0}''!",
entry.name));
}
}
};
deleteLink.add(new JavascriptEventConfirmation("onclick", MessageFormat.format(
"Delete proposal \"{0}\"?", entry.name)));
item.add(deleteLink);
WicketUtils.setAlternatingBackground(item, counter);
counter++;
}
};
add(dataView);
}
示例8: UsersPanel
import com.gitblit.wicket.WicketUtils; //導入方法依賴的package包/類
public UsersPanel(String wicketId, final boolean showAdmin) {
super(wicketId);
Fragment adminLinks = new Fragment("adminPanel", "adminLinks", this);
adminLinks.add(new BookmarkablePageLink<Void>("newUser", EditUserPage.class)
.setVisible(GitBlit.self().supportsAddUser()));
add(adminLinks.setVisible(showAdmin));
final List<UserModel> users = GitBlit.self().getAllUsers();
DataView<UserModel> usersView = new DataView<UserModel>("userRow",
new ListDataProvider<UserModel>(users)) {
private static final long serialVersionUID = 1L;
private int counter;
@Override
protected void onBeforeRender() {
super.onBeforeRender();
counter = 0;
}
public void populateItem(final Item<UserModel> item) {
final UserModel entry = item.getModelObject();
LinkPanel editLink = new LinkPanel("username", "list", entry.username,
EditUserPage.class, WicketUtils.newUsernameParameter(entry.username));
WicketUtils.setHtmlTooltip(editLink, getString("gb.edit") + " " + entry.getDisplayName());
item.add(editLink);
if (StringUtils.isEmpty(entry.displayName)) {
item.add(new Label("displayName").setVisible(false));
} else {
editLink = new LinkPanel("displayName", "list", entry.getDisplayName(),
EditUserPage.class, WicketUtils.newUsernameParameter(entry.username));
WicketUtils.setHtmlTooltip(editLink, getString("gb.edit") + " " + entry.getDisplayName());
item.add(editLink);
}
if (StringUtils.isEmpty(entry.emailAddress)) {
item.add(new Label("emailAddress").setVisible(false));
} else {
editLink = new LinkPanel("emailAddress", "list", entry.emailAddress,
EditUserPage.class, WicketUtils.newUsernameParameter(entry.username));
WicketUtils.setHtmlTooltip(editLink, getString("gb.edit") + " " + entry.getDisplayName());
item.add(editLink);
}
item.add(new Label("accountType", entry.accountType.name() + (entry.canAdmin() ? ", admin":"")));
item.add(new Label("teams", entry.teams.size() > 0 ? ("" + entry.teams.size()) : ""));
item.add(new Label("repositories",
entry.permissions.size() > 0 ? ("" + entry.permissions.size()) : ""));
Fragment userLinks = new Fragment("userLinks", "userAdminLinks", this);
userLinks.add(new BookmarkablePageLink<Void>("editUser", EditUserPage.class,
WicketUtils.newUsernameParameter(entry.username)));
Link<Void> deleteLink = new Link<Void>("deleteUser") {
private static final long serialVersionUID = 1L;
@Override
public void onClick() {
if (GitBlit.self().deleteUser(entry.username)) {
users.remove(entry);
info(MessageFormat.format(getString("gb.userDeleted"), entry.username));
} else {
error(MessageFormat.format(getString("gb.deleteUserFailed"),
entry.username));
}
}
};
deleteLink.add(new JavascriptEventConfirmation("onclick", MessageFormat.format(
getString("gb.deleteUser"), entry.username)));
userLinks.add(deleteLink);
item.add(userLinks);
WicketUtils.setAlternatingBackground(item, counter);
counter++;
}
};
add(usersView.setVisible(showAdmin));
}
示例9: TeamsPanel
import com.gitblit.wicket.WicketUtils; //導入方法依賴的package包/類
public TeamsPanel(String wicketId, final boolean showAdmin) {
super(wicketId);
Fragment adminLinks = new Fragment("adminPanel", "adminLinks", this);
adminLinks.add(new BookmarkablePageLink<Void>("newTeam", EditTeamPage.class));
add(adminLinks.setVisible(showAdmin && GitBlit.self().supportsTeamMembershipChanges(null)));
final List<TeamModel> teams = GitBlit.self().getAllTeams();
DataView<TeamModel> teamsView = new DataView<TeamModel>("teamRow",
new ListDataProvider<TeamModel>(teams)) {
private static final long serialVersionUID = 1L;
private int counter;
@Override
protected void onBeforeRender() {
super.onBeforeRender();
counter = 0;
}
public void populateItem(final Item<TeamModel> item) {
final TeamModel entry = item.getModelObject();
LinkPanel editLink = new LinkPanel("teamname", "list", entry.name,
EditTeamPage.class, WicketUtils.newTeamnameParameter(entry.name));
WicketUtils.setHtmlTooltip(editLink, getString("gb.edit") + " " + entry.name);
item.add(editLink);
item.add(new Label("members", entry.users.size() > 0 ? ("" + entry.users.size())
: ""));
item.add(new Label("repositories",
entry.repositories.size() > 0 ? ("" + entry.repositories.size()) : ""));
Fragment teamLinks = new Fragment("teamLinks", "teamAdminLinks", this);
teamLinks.add(new BookmarkablePageLink<Void>("editTeam", EditTeamPage.class,
WicketUtils.newTeamnameParameter(entry.name)));
Link<Void> deleteLink = new Link<Void>("deleteTeam") {
private static final long serialVersionUID = 1L;
@Override
public void onClick() {
if (GitBlit.self().deleteTeam(entry.name)) {
teams.remove(entry);
info(MessageFormat.format("Team ''{0}'' deleted.", entry.name));
} else {
error(MessageFormat
.format("Failed to delete team ''{0}''!", entry.name));
}
}
};
deleteLink.add(new JavascriptEventConfirmation("onclick", MessageFormat.format(
"Delete team \"{0}\"?", entry.name)));
teamLinks.add(deleteLink);
item.add(teamLinks);
WicketUtils.setAlternatingBackground(item, counter);
counter++;
}
};
add(teamsView.setVisible(showAdmin));
}