import java.util.ArrayList;\r
import java.util.List;\r
\r
+import org.apache.wicket.Component;\r
import org.apache.wicket.PageParameters;\r
import org.apache.wicket.markup.html.basic.Label;\r
import org.apache.wicket.markup.html.form.ListMultipleChoice;\r
import org.apache.wicket.markup.html.form.StatelessForm;\r
import org.apache.wicket.markup.html.form.TextField;\r
+import org.apache.wicket.markup.html.panel.Fragment;\r
import org.apache.wicket.markup.repeater.Item;\r
import org.apache.wicket.markup.repeater.data.DataView;\r
import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
repositories.add(repository);\r
}\r
\r
- page = WicketUtils.getPage(params); \r
+ page = WicketUtils.getPage(params);\r
\r
if (params.containsKey("repositories")) {\r
String value = params.getString("repositories", "");\r
final DataView<SearchResult> resultsView = new DataView<SearchResult>("searchResults", resultsDp) {\r
private static final long serialVersionUID = 1L;\r
public void populateItem(final Item<SearchResult> item) {\r
- SearchResult sr = item.getModelObject();\r
+ final SearchResult sr = item.getModelObject();\r
switch(sr.type) {\r
case commit: {\r
Label icon = WicketUtils.newIcon("type", "icon-refresh");\r
WicketUtils.setHtmlTooltip(icon, "commit");\r
item.add(icon);\r
item.add(new LinkPanel("summary", null, sr.summary, CommitPage.class, WicketUtils.newObjectParameter(sr.repository, sr.commitId)));\r
+ // show tags\r
+ Fragment fragment = new Fragment("tags", "tagsPanel", LuceneSearchPage.this);\r
+ List<String> tags = sr.tags;\r
+ if (tags == null) {\r
+ tags = new ArrayList<String>();\r
+ }\r
+ ListDataProvider<String> tagsDp = new ListDataProvider<String>(tags);\r
+ final DataView<String> tagsView = new DataView<String>("tag", tagsDp) {\r
+ private static final long serialVersionUID = 1L;\r
+ public void populateItem(final Item<String> item) {\r
+ String tag = item.getModelObject();\r
+ Component c = new LinkPanel("tagLink", null, tag, TagPage.class,\r
+ WicketUtils.newObjectParameter(sr.repository, Constants.R_TAGS + tag));\r
+ WicketUtils.setCssClass(c, "tagRef"); \r
+ item.add(c);\r
+ }\r
+ };\r
+ fragment.add(tagsView);\r
+ item.add(fragment);\r
break;\r
}\r
case blob: {\r
WicketUtils.setHtmlTooltip(icon, "blob");\r
item.add(icon);\r
item.add(new LinkPanel("summary", null, sr.path, BlobPage.class, WicketUtils.newPathParameter(sr.repository, sr.branch, sr.path)));\r
+ item.add(new Label("tags").setVisible(false));\r
break;\r
}\r
case issue: {\r
WicketUtils.setHtmlTooltip(icon, "issue");\r
item.add(icon);\r
item.add(new Label("summary", "issue: " + sr.issueId));\r
+ item.add(new Label("tags").setVisible(false));\r
break;\r
}\r
}\r
add(new PagerPanel("topPager", page, totalPages, LuceneSearchPage.class, pagerParams));\r
add(new PagerPanel("bottomPager", page, totalPages, LuceneSearchPage.class, pagerParams));\r
}\r
- \r
-// private String buildPager(int currentPage, int count, int total) {\r
-// int pages = (total / count) + (total % count == 0 ? 0 : 1);\r
-// \r
-// // pages are 1-indexed\r
-// // previous page link\r
-// if (currentPage <= 1) {\r
-// sb.append(MessageFormat.format(li, "disabled", "#", "←"));\r
-// } else {\r
-// List<String> parameters = new ArrayList<String>();\r
-// if (!StringUtils.isEmpty(penString)) {\r
-// parameters.add(penString);\r
-// }\r
-// parameters.add(MessageFormat.format(pg, currentPage - 1));\r
-// sb.append(MessageFormat.format(li, "", StringUtils.flattenStrings(parameters, "&"), "←"));\r
-// }\r
-//\r
-// // page links in middle\r
-// int minpage = Math.max(1, currentPage - Math.min(2, 2));\r
-// int maxpage = Math.min(pages, minpage + 4);\r
-// for (int i = minpage; i <= maxpage; i++) {\r
-// String cssClass = "";\r
-// if (i == currentPage) {\r
-// cssClass = "active";\r
-// }\r
-// List<String> parameters = new ArrayList<String>();\r
-// if (!StringUtils.isEmpty(penString)) {\r
-// parameters.add(penString);\r
-// }\r
-// parameters.add(MessageFormat.format(pg, i));\r
-// sb.append(MessageFormat.format(li, cssClass, StringUtils.flattenStrings(parameters, "&"), i));\r
-// }\r
-//\r
-// // next page link\r
-// if (currentPage == pages) {\r
-// sb.append(MessageFormat.format(li, "disabled", "#", "→"));\r
-// } else {\r
-// List<String> parameters = new ArrayList<String>();\r
-// if (!StringUtils.isEmpty(penString)) {\r
-// parameters.add(penString);\r
-// }\r
-// parameters.add(MessageFormat.format(pg, currentPage + 1));\r
-// sb.append(MessageFormat.format(li, "", StringUtils.flattenStrings(parameters, "&"), "→"));\r
-// }\r
-// return sb.toString();\r
-// }\r
-\r
}\r