isSelected = false;
} else {
parameters = new PageParameters(params);
- if (parameters.containsKey(parameter)) {
- isSelected = params.getString(parameter).equals(value);
+// if (parameters.containsKey(parameter)) {
+ if (!parameters.get(parameter).isEmpty()) {
+ isSelected = params.get(parameter).toString().equals(value);
// set the new selection value
setParameter(parameter, value);
} else {
if (StringUtils.isEmpty(value)) {
this.parameters.remove(parameter);
} else {
- this.parameters.put(parameter, value);
+ this.parameters.add(parameter, value);
}
}
}
import java.util.concurrent.atomic.AtomicBoolean;\r
\r
import org.apache.wicket.Page;\r
+import org.apache.wicket.request.Request;\r
+import org.apache.wicket.request.cycle.RequestCycle;\r
import org.apache.wicket.request.mapper.parameter.PageParameters;\r
import org.apache.wicket.RedirectToUrlException;\r
-import org.apache.wicket.Request;\r
import org.apache.wicket.Session;\r
import org.apache.wicket.protocol.http.RequestUtils;\r
-import org.apache.wicket.protocol.http.WebRequestCycle;\r
import org.apache.wicket.protocol.http.WebSession;\r
import org.apache.wicket.protocol.http.request.WebClientInfo;\r
\r
*/\r
public void cacheRequest(Class<? extends Page> pageClass) {\r
// build absolute url with correctly encoded parameters?!\r
- Request req = WebRequestCycle.get().getRequest();\r
+ Request req = RequestCycle.get().getRequest();\r
Map<String, ?> params = req.getRequestParameters().getParameters();\r
PageParameters pageParams = new PageParameters(params);\r
- String relativeUrl = WebRequestCycle.get().urlFor(pageClass, pageParams).toString();\r
+ String relativeUrl = RequestCycle.get().urlFor(pageClass, pageParams).toString();\r
requestUrl = RequestUtils.toAbsolutePath(relativeUrl);\r
if (isTemporary())\r
{\r
import org.apache.wicket.AbstractRestartResponseException;
import org.apache.wicket.Page;
+import org.apache.wicket.request.cycle.RequestCycle;
import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.wicket.RequestCycle;
import org.apache.wicket.protocol.http.RequestUtils;
import org.apache.wicket.request.target.basic.RedirectRequestTarget;
import org.apache.wicket.markup.html.form.AbstractTextComponent.ITextFormatProvider;
import org.apache.wicket.model.IModel;
import org.apache.wicket.util.convert.IConverter;
-import org.apache.wicket.util.convert.converters.DateConverter;
+import org.apache.wicket.util.convert.converter.DateConverter;
public class Html5DateField extends TextField<Date> implements ITextFormatProvider {
import java.util.Map;
import org.apache.wicket.Page;
-import org.apache.wicket.RequestCycle;
+import org.apache.wicket.request.cycle.RequestCycle;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.mylyn.wikitext.confluence.core.ConfluenceLanguage;
import org.apache.wicket.markup.MarkupStream;
import org.apache.wicket.markup.html.form.StatelessForm;
import org.apache.wicket.protocol.http.RequestUtils;
-import org.apache.wicket.protocol.http.WicketURLDecoder;
-import org.apache.wicket.protocol.http.request.WebRequestCodingStrategy;
+//import org.apache.wicket.protocol.http.WicketURLDecoder;
+//import org.apache.wicket.protocol.http.request.WebRequestCodingStrategy;
import org.apache.wicket.util.string.AppendingStringBuffer;
import org.apache.wicket.util.string.Strings;
import org.slf4j.Logger;
* The open tag for the body
*/
@Override
- protected void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag)
+ public void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag)
{
// render the hidden bookmarkable page field
AppendingStringBuffer buffer = new AppendingStringBuffer(HIDDEN_DIV_START);
\r
import javax.servlet.http.HttpServletRequest;\r
\r
+import org.apache.wicket.AttributeModifier;\r
import org.apache.wicket.Component;\r
+import org.apache.wicket.request.Request;\r
+import org.apache.wicket.request.http.WebRequest;\r
import org.apache.wicket.request.mapper.parameter.PageParameters;\r
-import org.apache.wicket.Request;\r
+import org.apache.wicket.request.resource.ContextRelativeResource;\r
import org.apache.wicket.behavior.AttributeAppender;\r
import org.apache.wicket.behavior.HeaderContributor;\r
-import org.apache.wicket.behavior.SimpleAttributeModifier;\r
import org.apache.wicket.markup.html.IHeaderContributor;\r
-import org.apache.wicket.markup.html.IHeaderResponse;\r
import org.apache.wicket.markup.html.basic.Label;\r
import org.apache.wicket.markup.html.image.ContextImage;\r
import org.apache.wicket.model.Model;\r
-import org.apache.wicket.protocol.http.WebRequest;\r
-import org.apache.wicket.resource.ContextRelativeResource;\r
import org.eclipse.jgit.diff.DiffEntry.ChangeType;\r
\r
import com.gitblit.Constants;\r
public class WicketUtils {\r
\r
public static void setCssClass(Component container, String value) {\r
- container.add(new SimpleAttributeModifier("class", value));\r
+ container.add(new AttributeModifier("class", value));\r
}\r
\r
public static void addCssClass(Component container, String value) {\r
}\r
\r
public static void setCssStyle(Component container, String value) {\r
- container.add(new SimpleAttributeModifier("style", value));\r
+ container.add(new AttributeModifier("style", value));\r
}\r
\r
public static void setCssBackground(Component container, String value) {\r
String background = MessageFormat.format("background-color:{0};",\r
StringUtils.getColor(value));\r
- container.add(new SimpleAttributeModifier("style", background));\r
+ container.add(new AttributeModifier("style", background));\r
}\r
\r
public static Component setHtmlTooltip(Component container, String value) {\r
- return container.add(new SimpleAttributeModifier("title", value));\r
+ return container.add(new AttributeModifier("title", value));\r
}\r
\r
public static void setInputPlaceholder(Component container, String value) {\r
- container.add(new SimpleAttributeModifier("placeholder", value));\r
+ container.add(new AttributeModifier("placeholder", value));\r
}\r
\r
public static void setChangeTypeCssClass(Component container, ChangeType type) {\r
}\r
\r
public static String getProjectName(PageParameters params) {\r
- return params.getString("p", "");\r
+ return params.get("p").toString("");\r
}\r
\r
public static String getRepositoryName(PageParameters params) {\r
- return params.getString("r", "");\r
+ return params.get("r").toString("");\r
}\r
\r
public static String getObject(PageParameters params) {\r
\r
public static int getPage(PageParameters params) {\r
// index from 1\r
- return params.getInt("pg", 1);\r
+ return params.get("pg").toInt(1);\r
}\r
\r
public static String getRegEx(PageParameters params) {\r
}\r
\r
public static String getNameParameter(PageParameters params) {\r
- return params.getString("n", "");\r
+ return params.get("n").toString("");\r
}\r
\r
public static Label createDateLabel(String wicketId, Date date, TimeZone timeZone, TimeUtils timeUtils) {\r
import javax.servlet.ServletContext;
-import org.apache.wicket.markup.html.IHeaderResponse;
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.head.JavaScriptHeaderItem;
+import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
import org.apache.wicket.protocol.http.WebApplication;
+import org.apache.wicket.request.resource.ContextRelativeResource;
+import org.apache.wicket.request.resource.ContextRelativeResourceReference;
/**
* Concrete class for Flotr2 charts
ServletContext servletContext = WebApplication.get().getServletContext();
String contextPath = servletContext.getContextPath();
- response.renderJavascriptReference(contextPath + "/bootstrap/js/jquery.js");
- response.renderJavascriptReference(contextPath + "/flotr2/flotr2.min.js");
- response.renderCSSReference(contextPath + "/flotr2/flotr2.custom.css");
+ response.render(JavaScriptHeaderItem.forReference(new ContextRelativeResourceReference(contextPath + "/bootstrap/js/jquery.js", false)));
+ response.render(JavaScriptHeaderItem.forReference(new ContextRelativeResourceReference(contextPath + "/flotr2/flotr2.min.js", false)));
+ response.render(JavaScriptHeaderItem.forReference(new ContextRelativeResourceReference(contextPath + "/flotr2/flotr2.custom.css", false)));
// prepare draw chart function
StringBuilder sb = new StringBuilder();
- line(sb, "$( document ).ready(function() {");
+// line(sb, "$( document ).ready(function() {");
line(sb, "try {");
// add charts to header
for (Chart chart : charts) {
line(sb, " }");
line(sb, "}");
// end draw chart function
- line(sb, "});");
- response.renderJavascript(sb.toString(), null);
+// line(sb, "});");
+ response.render(OnDomReadyHeaderItem.forScript(sb.toString()));
}
@Override
* MarkupStream, org.apache.wicket.markup.ComponentTag)\r
*/\r
@Override\r
- protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)\r
+ public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)\r
{\r
if (!Strings.isEmpty(stackTraceAsString))\r
{\r
import java.util.HashMap;\r
import java.util.Map;\r
\r
-import org.apache.wicket.ResourceReference;\r
+import org.apache.wicket.markup.head.IHeaderResponse;\r
+import org.apache.wicket.markup.head.JavaScriptHeaderItem;\r
import org.apache.wicket.markup.html.IHeaderContributor;\r
-import org.apache.wicket.markup.html.IHeaderResponse;\r
+import org.apache.wicket.request.resource.PackageResourceReference;\r
\r
import com.google.gson.Gson;\r
import com.google.gson.GsonBuilder;\r
@Override\r
public void renderHead(IHeaderResponse response) {\r
// add Google AngularJS reference\r
- response.renderJavascriptReference(new ResourceReference(NgController.class, "angular.js"));\r
+ response.render(JavaScriptHeaderItem.forReference(new PackageResourceReference(NgController.class, "angular.js")));\r
\r
Gson gson = new GsonBuilder().create();\r
\r
}\r
line(sb, "}");\r
\r
- response.renderJavascript(sb.toString(), null);\r
+ response.render(JavaScriptHeaderItem.forScript(sb.toString(), "angularController"));\r
}\r
\r
private void line(StringBuilder sb, String line) {\r
\r
PageParameters currentParameters = getPageParameters();\r
int daysBack = app().settings().getInteger(Keys.web.activityDuration, 7);\r
- if (currentParameters != null && !currentParameters.containsKey("db")) {\r
- currentParameters.put("db", daysBack);\r
+ if (currentParameters != null && currentParameters.get("db").isEmpty()) {\r
+ currentParameters.add("db", daysBack);\r
}\r
\r
// preserve time filter options on repository choices\r
\r
page = WicketUtils.getPage(params);\r
\r
- if (params.containsKey("repositories")) {\r
- String value = params.getString("repositories", "");\r
+ if (!params.get("repositories").isEmpty()) {\r
+ String value = params.get("repositories").toString("");\r
List<String> list = StringUtils.getStringsFromValue(value);\r
repositories.addAll(list);\r
}\r
\r
- allRepos = params.getAsBoolean("allrepos", false);
+ allRepos = params.get("allrepos").toBoolean(false);
if (allRepos) {\r
repositories.addAll(availableRepositories);\r
}\r
\r
- if (params.containsKey("query")) {\r
- query = params.getString("query", "");\r
+ if (!params.get("query").isEmpty()) {\r
+ query = params.get("query").toString("");\r
} else {\r
String value = WicketUtils.getSearchString(params);\r
String type = WicketUtils.getSearchType(params);\r
return;\r
}\r
PageParameters params = new PageParameters();\r
- params.put("repositories", StringUtils.flattenStrings(repositoriesModel.getObject()));\r
- params.put("query", queryModel.getObject());\r
- params.put("allrepos", allreposModel.getObject());\r
+ params.add("repositories", StringUtils.flattenStrings(repositoriesModel.getObject()));\r
+ params.add("query", queryModel.getObject());\r
+ params.add("allrepos", allreposModel.getObject());\r
LuceneSearchPage page = new LuceneSearchPage(params);\r
setResponsePage(page);\r
}\r
add(resultsView.setVisible(results.size() > 0));\r
\r
PageParameters pagerParams = new PageParameters();\r
- pagerParams.put("repositories", StringUtils.flattenStrings(repositoriesModel.getObject()));\r
- pagerParams.put("query", queryModel.getObject());\r
+ pagerParams.add("repositories", StringUtils.flattenStrings(repositoriesModel.getObject()));\r
+ pagerParams.add("query", queryModel.getObject());\r
\r
boolean showPager = false;\r
int totalPages = 0;\r
final String username = currentUser.getName();
final String[] statiiParam = (params == null) ? TicketsUI.openStatii : params.getStringArray(Lucene.status.name());
- final String assignedToParam = (params == null) ? "" : params.getString(Lucene.responsible.name(), null);
- final String milestoneParam = (params == null) ? "" : params.getString(Lucene.milestone.name(), null);
- final String queryParam = (params == null) ? null : params.getString("q", null);
- final String searchParam = (params == null) ? "" : params.getString("s", null);
- final String sortBy = (params == null) ? "" : Lucene.fromString(params.getString("sort", Lucene.created.name())).name();
- final String repositoryId = (params == null) ? "" : params.getString(Lucene.rid.name(), null);
- final boolean desc = (params == null) ? true : !"asc".equals(params.getString("direction", "desc"));
+ final String assignedToParam = (params == null) ? "" : params.get(Lucene.responsible.name()).toString();
+ final String milestoneParam = (params == null) ? "" : params.get(Lucene.milestone.name()).toString();
+ final String queryParam = (params == null) ? null : params.get("q").toString();
+ final String searchParam = (params == null) ? "" : params.get("s").toString();
+ final String sortBy = (params == null) ? "" : Lucene.fromString(params.get("sort").toString(Lucene.created.name())).name();
+ final String repositoryId = (params == null) ? "" : params.get(Lucene.rid.name()).toString();
+ final boolean desc = (params == null) ? true : !"asc".equals(params.get("direction").toString("desc"));
// add the user title panel
public PatchPage(final PageParameters params) {\r
super(params);\r
\r
- if (!params.containsKey("r")) {\r
+ if (params.get("r").isEmpty()) {\r
error(getString("gb.repositoryNotSpecified"));\r
redirectToInterceptPage(new RepositoriesPage());\r
}\r
\r
import javax.servlet.http.HttpServletResponse;\r
\r
-import org.apache.wicket.IRequestTarget;\r
+import org.apache.wicket.request.cycle.RequestCycle;\r
+import org.apache.wicket.request.http.WebRequest;\r
+import org.apache.wicket.request.http.WebResponse;\r
import org.apache.wicket.request.mapper.parameter.PageParameters;\r
-import org.apache.wicket.RequestCycle;\r
-import org.apache.wicket.protocol.http.WebRequest;\r
-import org.apache.wicket.protocol.http.WebResponse;\r
import org.apache.wicket.protocol.http.servlet.AbortWithWebErrorCodeException;\r
import org.eclipse.jgit.lib.Repository;\r
import org.eclipse.jgit.revwalk.RevCommit;\r
public RawPage(final PageParameters params) {\r
super(params);\r
\r
- if (!params.containsKey("r")) {\r
+ if (params.get("r").isEmpty()) {\r
error(getString("gb.repositoryNotSpecified"));\r
redirectToInterceptPage(new RepositoriesPage());\r
}\r
import javax.servlet.http.HttpServletResponse;
import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.request.http.WebRequest;
+import org.apache.wicket.request.http.WebResponse;
import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.wicket.RequestCycle;
import org.apache.wicket.behavior.HeaderContributor;
+import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.html.IHeaderContributor;
-import org.apache.wicket.markup.html.IHeaderResponse;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.repeater.data.ListDataProvider;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
-import org.apache.wicket.protocol.http.WebRequest;
-import org.apache.wicket.protocol.http.WebResponse;
import com.gitblit.Constants;
import com.gitblit.Constants.AuthenticationType;
clonedParams = new PageParameters(params);
}
- if (!clonedParams.containsKey("db")) {
- clonedParams.put("db", daysBack);
+ if (clonedParams.get("db").isEmpty()) {
+ clonedParams.add("db", daysBack);
}
List<MenuItem> items = new ArrayList<MenuItem>();
String set = WicketUtils.getSet(params);
String regex = WicketUtils.getRegEx(params);
String team = WicketUtils.getTeam(params);
- int daysBack = params.getInt("db", 0);
+ int daysBack = params.get("db").toInt(0);
int maxDaysBack = app().settings().getInteger(Keys.web.activityDurationMaximum, 30);
List<RepositoryModel> availableModels = getRepositoryModels();
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.apache.wicket.request.http.WebRequest;
+import org.apache.wicket.request.http.WebResponse;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.markup.html.WebPage;
-import org.apache.wicket.protocol.http.WebRequest;
-import org.apache.wicket.protocol.http.WebResponse;
import com.gitblit.Constants;
import com.gitblit.Constants.AuthenticationType;
} else {\r
milestoneParameters = WicketUtils.newRepositoryParameter(repositoryName);\r
}\r
- milestoneParameters.put(Lucene.milestone.name(), ticket.milestone);\r
+ milestoneParameters.add(Lucene.milestone.name(), ticket.milestone);\r
int progress = 0;\r
int open = 0;\r
int closed = 0;\r
import java.util.Set;\r
import java.util.TreeSet;\r
\r
+import org.apache.wicket.AttributeModifier;\r
import org.apache.wicket.Component;\r
import org.apache.wicket.request.mapper.parameter.PageParameters;\r
-import org.apache.wicket.behavior.SimpleAttributeModifier;\r
import org.apache.wicket.markup.html.basic.Label;\r
import org.apache.wicket.markup.html.link.BookmarkablePageLink;\r
import org.apache.wicket.markup.html.panel.Fragment;\r
tq.color = StringUtils.getColor(tq.name);\r
}\r
String background = MessageFormat.format("background-color:{0};", tq.color);\r
- swatch.add(new SimpleAttributeModifier("style", background));\r
+ swatch.add(new AttributeModifier("style", background));\r
item.add(swatch);\r
if (activeQuery.contains(tq.query)) {\r
// selected\r
Label checked = new Label("checked");\r
WicketUtils.setCssClass(checked, "iconic-o-x");\r
item.add(checked);\r
- item.add(new SimpleAttributeModifier("style", background));\r
+ item.add(new AttributeModifier("style", background));\r
} else {\r
// unselected\r
String q = QueryBuilder.q(queryParam).toSubquery().and(tq.query).build();\r
@Override\r
protected void onUpdate(AjaxRequestTarget target) {\r
choice.setEnabled(checkbox.getModelObject());\r
- target.addComponent(choice);\r
+ target.add(choice);\r
if (!choice.isEnabled()) {\r
choice.setModelObject(null);\r
}\r
import java.util.List;\r
import java.util.Map;\r
\r
-import org.apache.wicket.Response;\r
import org.apache.wicket.markup.ComponentTag;\r
import org.apache.wicket.markup.MarkupStream;\r
+import org.apache.wicket.request.Response;\r
import org.apache.wicket.util.value.IValueMap;\r
\r
/**\r