\r
#### fixes \r
\r
+- Uppercase repositories not selectable in edit palettes (issue 71)\r
- Activity page now displays all local branches (issue 65)\r
- Fixed (harmless) nullpointer on pushing to an empty repository (issue 69)\r
- Fixed possible nullpointer from the servlet container on startup (issue 67)\r
--- /dev/null
+/*
+ * Copyright 2012 gitblit.com.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gitblit.wicket;
+
+import org.apache.wicket.markup.html.form.ChoiceRenderer;
+
+/**
+ * Choice renderer for a palette or list of string values. This renderer
+ * controls the id value of each option such that palettes are case insensitive.
+ *
+ * @author James Moger
+ *
+ */
+public class StringChoiceRenderer extends ChoiceRenderer<String> {
+
+ private static final long serialVersionUID = 1L;
+
+ public StringChoiceRenderer() {
+ super("", "");
+ }
+
+ /**
+ * @see org.apache.wicket.markup.html.form.IChoiceRenderer#getIdValue(java.lang.Object, int)
+ */
+ @Override
+ public String getIdValue(String object, int index)
+ {
+ return object.toLowerCase();
+ }
+}
import org.apache.wicket.extensions.markup.html.form.palette.Palette;\r
import org.apache.wicket.markup.html.form.Button;\r
import org.apache.wicket.markup.html.form.CheckBox;\r
-import org.apache.wicket.markup.html.form.ChoiceRenderer;\r
import org.apache.wicket.markup.html.form.DropDownChoice;\r
import org.apache.wicket.markup.html.form.Form;\r
import org.apache.wicket.markup.html.form.IChoiceRenderer;\r
import com.gitblit.utils.ArrayUtils;\r
import com.gitblit.utils.StringUtils;\r
import com.gitblit.wicket.GitBlitWebSession;\r
+import com.gitblit.wicket.StringChoiceRenderer;\r
import com.gitblit.wicket.WicketUtils;\r
import com.gitblit.wicket.panels.BulletListPanel;\r
\r
// users palette\r
final Palette<String> usersPalette = new Palette<String>("users", new ListModel<String>(\r
repositoryUsers), new CollectionModel<String>(GitBlit.self().getAllUsernames()),\r
- new ChoiceRenderer<String>("", ""), 10, false);\r
+ new StringChoiceRenderer(), 10, false);\r
\r
// teams palette\r
final Palette<String> teamsPalette = new Palette<String>("teams", new ListModel<String>(\r
repositoryTeams), new CollectionModel<String>(GitBlit.self().getAllTeamnames()),\r
- new ChoiceRenderer<String>("", ""), 5, false);\r
+ new StringChoiceRenderer(), 5, false);\r
\r
// federation sets palette\r
List<String> sets = GitBlit.getStrings(Keys.federation.sets);\r
final Palette<String> federationSetsPalette = new Palette<String>("federationSets",\r
new ListModel<String>(federationSets), new CollectionModel<String>(sets),\r
- new ChoiceRenderer<String>("", ""), 5, false);\r
+ new StringChoiceRenderer(), 5, false);\r
\r
// pre-receive palette\r
if (!ArrayUtils.isEmpty(repositoryModel.preReceiveScripts)) {\r
final Palette<String> preReceivePalette = new Palette<String>("preReceiveScripts",\r
new ListModel<String>(preReceiveScripts), new CollectionModel<String>(GitBlit\r
.self().getPreReceiveScriptsUnused(repositoryModel)),\r
- new ChoiceRenderer<String>("", ""), 12, true);\r
+ new StringChoiceRenderer(), 12, true);\r
\r
// post-receive palette\r
if (!ArrayUtils.isEmpty(repositoryModel.postReceiveScripts)) {\r
final Palette<String> postReceivePalette = new Palette<String>("postReceiveScripts",\r
new ListModel<String>(postReceiveScripts), new CollectionModel<String>(GitBlit\r
.self().getPostReceiveScriptsUnused(repositoryModel)),\r
- new ChoiceRenderer<String>("", ""), 12, true);\r
+ new StringChoiceRenderer(), 12, true);\r
\r
CompoundPropertyModel<RepositoryModel> model = new CompoundPropertyModel<RepositoryModel>(\r
repositoryModel);\r
import org.apache.wicket.behavior.SimpleAttributeModifier;\r
import org.apache.wicket.extensions.markup.html.form.palette.Palette;\r
import org.apache.wicket.markup.html.form.Button;\r
-import org.apache.wicket.markup.html.form.ChoiceRenderer;\r
import org.apache.wicket.markup.html.form.Form;\r
import org.apache.wicket.markup.html.form.TextField;\r
import org.apache.wicket.model.CompoundPropertyModel;\r
import com.gitblit.models.TeamModel;\r
import com.gitblit.utils.StringUtils;\r
import com.gitblit.wicket.RequiresAdminRole;\r
+import com.gitblit.wicket.StringChoiceRenderer;\r
import com.gitblit.wicket.WicketUtils;\r
import com.gitblit.wicket.panels.BulletListPanel;\r
\r
// repositories palette\r
final Palette<String> repositories = new Palette<String>("repositories",\r
new ListModel<String>(new ArrayList<String>(teamModel.repositories)),\r
- new CollectionModel<String>(repos), new ChoiceRenderer<String>("", ""), 10, false);\r
+ new CollectionModel<String>(repos), new StringChoiceRenderer(), 10, false);\r
\r
// users palette\r
final Palette<String> users = new Palette<String>("users", new ListModel<String>(\r
new ArrayList<String>(teamUsers)), new CollectionModel<String>(GitBlit.self()\r
- .getAllUsernames()), new ChoiceRenderer<String>("", ""), 10, false);\r
+ .getAllUsernames()), new StringChoiceRenderer(), 10, false);\r
\r
// pre-receive palette\r
if (teamModel.preReceiveScripts != null) {\r
}\r
final Palette<String> preReceivePalette = new Palette<String>("preReceiveScripts",\r
new ListModel<String>(preReceiveScripts), new CollectionModel<String>(GitBlit\r
- .self().getPreReceiveScriptsUnused(null)), new ChoiceRenderer<String>("",\r
- ""), 12, true);\r
+ .self().getPreReceiveScriptsUnused(null)), new StringChoiceRenderer(),\r
+ 12, true);\r
\r
// post-receive palette\r
if (teamModel.postReceiveScripts != null) {\r
}\r
final Palette<String> postReceivePalette = new Palette<String>("postReceiveScripts",\r
new ListModel<String>(postReceiveScripts), new CollectionModel<String>(GitBlit\r
- .self().getPostReceiveScriptsUnused(null)), new ChoiceRenderer<String>("",\r
- ""), 12, true);\r
+ .self().getPostReceiveScriptsUnused(null)), new StringChoiceRenderer(),\r
+ 12, true);\r
\r
Form<TeamModel> form = new Form<TeamModel>("editForm", model) {\r
\r
import org.apache.wicket.extensions.markup.html.form.palette.Palette;\r
import org.apache.wicket.markup.html.form.Button;\r
import org.apache.wicket.markup.html.form.CheckBox;\r
-import org.apache.wicket.markup.html.form.ChoiceRenderer;\r
import org.apache.wicket.markup.html.form.Form;\r
import org.apache.wicket.markup.html.form.PasswordTextField;\r
import org.apache.wicket.markup.html.form.TextField;\r
import com.gitblit.models.UserModel;\r
import com.gitblit.utils.StringUtils;\r
import com.gitblit.wicket.RequiresAdminRole;\r
+import com.gitblit.wicket.StringChoiceRenderer;\r
import com.gitblit.wicket.WicketUtils;\r
\r
@RequiresAdminRole\r
final String oldName = userModel.username;\r
final Palette<String> repositories = new Palette<String>("repositories",\r
new ListModel<String>(new ArrayList<String>(userModel.repositories)),\r
- new CollectionModel<String>(repos), new ChoiceRenderer<String>("", ""), 10, false);\r
+ new CollectionModel<String>(repos), new StringChoiceRenderer(), 10, false);\r
final Palette<String> teams = new Palette<String>("teams", new ListModel<String>(\r
new ArrayList<String>(userTeams)), new CollectionModel<String>(GitBlit.self()\r
- .getAllTeamnames()), new ChoiceRenderer<String>("", ""), 10, false);\r
+ .getAllTeamnames()), new StringChoiceRenderer(), 10, false);\r
Form<UserModel> form = new Form<UserModel>("editForm", model) {\r
\r
private static final long serialVersionUID = 1L;\r