]> source.dussan.org Git - gitblit.git/commitdiff
Replace ChoiceRenderer with StringChoiceRenderer (issue 71)
authorJames Moger <james.moger@gitblit.com>
Mon, 5 Mar 2012 21:32:18 +0000 (16:32 -0500)
committerJames Moger <james.moger@gitblit.com>
Mon, 5 Mar 2012 21:32:18 +0000 (16:32 -0500)
docs/04_releases.mkd
src/com/gitblit/wicket/StringChoiceRenderer.java [new file with mode: 0644]
src/com/gitblit/wicket/pages/EditRepositoryPage.java
src/com/gitblit/wicket/pages/EditTeamPage.java
src/com/gitblit/wicket/pages/EditUserPage.java

index da886334af103872b135619d0f453c1daf72c604..fed78166a17929a09c38d116f33f99e583d72d5d 100644 (file)
@@ -30,6 +30,7 @@ Push requests to these repositories will be rejected.
 \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
diff --git a/src/com/gitblit/wicket/StringChoiceRenderer.java b/src/com/gitblit/wicket/StringChoiceRenderer.java
new file mode 100644 (file)
index 0000000..58ed479
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * 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();
+       }
+}
index 0361da3e4345638b080ca862964e61fc072b342a..1eae2c986e953ec7d8b8114d00b5d8afb5608148 100644 (file)
@@ -30,7 +30,6 @@ import org.apache.wicket.behavior.SimpleAttributeModifier;
 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
@@ -51,6 +50,7 @@ import com.gitblit.models.UserModel;
 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
@@ -104,18 +104,18 @@ public class EditRepositoryPage extends RootSubPage {
                // 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
@@ -124,7 +124,7 @@ public class EditRepositoryPage extends RootSubPage {
                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
@@ -133,7 +133,7 @@ public class EditRepositoryPage extends RootSubPage {
                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
index 57e97351d7f7e0b8698157b9e9ea3d8322b504dd..2ed5fba68deb9a47ebc42399b036dc1a80452d45 100644 (file)
@@ -27,7 +27,6 @@ import org.apache.wicket.PageParameters;
 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
@@ -43,6 +42,7 @@ import com.gitblit.models.RepositoryModel;
 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
@@ -97,12 +97,12 @@ public class EditTeamPage extends RootSubPage {
                // 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
@@ -110,8 +110,8 @@ public class EditTeamPage extends RootSubPage {
                }\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
@@ -119,8 +119,8 @@ public class EditTeamPage extends RootSubPage {
                }\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
index 62d955e2a534eaa583387b43944698e7634ec2d1..3e14d08347e4c1fbd7f1c06b4ff7997634e121be 100644 (file)
@@ -26,7 +26,6 @@ import org.apache.wicket.behavior.SimpleAttributeModifier;
 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
@@ -44,6 +43,7 @@ import com.gitblit.models.TeamModel;
 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
@@ -94,10 +94,10 @@ public class EditUserPage extends RootSubPage {
                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