diff --git a/core/src/main/java/hudson/model/TreeView.java b/core/src/main/java/hudson/model/TreeView.java deleted file mode 100644 index 8c9543f15a..0000000000 --- a/core/src/main/java/hudson/model/TreeView.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * The MIT License - * - * Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package hudson.model; - -import hudson.model.Descriptor.FormException; -import hudson.util.CaseInsensitiveComparator; -import hudson.Indenter; -import hudson.Extension; -import jenkins.util.SystemProperties; -import hudson.views.ViewsTabBar; -import jenkins.model.Jenkins; -import org.kohsuke.stapler.DataBoundConstructor; -import org.kohsuke.stapler.StaplerRequest; -import org.kohsuke.stapler.StaplerResponse; - -import javax.servlet.ServletException; -import java.io.IOException; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Set; -import java.util.TreeSet; -import java.util.concurrent.CopyOnWriteArrayList; -import org.kohsuke.stapler.interceptor.RequirePOST; -import org.kohsuke.stapler.verb.POST; - -/** - * - *

EXPERIMENTAL

- *

- * The intention is to eventually merge this with the {@link ListView}. - * This class is here for experimentation. - * - *

- * Until this class is sufficiently stable, there's no need for l10n. - * TODO: use ViewGroupMixIn - * - * @author Kohsuke Kawaguchi - */ -public class TreeView extends View implements ViewGroup { - /** - * List of job names. This is what gets serialized. - */ - private final Set jobNames - = new TreeSet<>(CaseInsensitiveComparator.INSTANCE); - - /** - * Nested views. - */ - private final CopyOnWriteArrayList views = new CopyOnWriteArrayList<>(); - - @DataBoundConstructor - public TreeView(String name) { - super(name); - } - - /** - * Returns {@link Indenter} that has the fixed indentation width. - * Used for assisting view rendering. - */ - public Indenter createFixedIndenter(String d) { - final int depth = Integer.parseInt(d); - return new Indenter() { - @Override - protected int getNestLevel(Job job) { return depth; } - }; - } - - /** - * Returns a read-only view of all {@link Job}s in this view. - * - *

- * This method returns a separate copy each time to avoid - * concurrent modification issue. - */ - @Override - public synchronized List getItems() { - return Jenkins.get().getItems(); - } - - @Override - public boolean contains(TopLevelItem item) { - return true; - } - - @Override - @POST - public TopLevelItem doCreateItem(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { - ItemGroup ig = getOwner().getItemGroup(); - if (ig instanceof ModifiableItemGroup) { - TopLevelItem item = ((ModifiableItemGroup)ig).doCreateItem(req, rsp); - if(item!=null) { - jobNames.add(item.getName()); - owner.save(); - } - return item; - } - return null; - } - - // TODO listen for changes that might affect jobNames - - @Override - protected void submit(StaplerRequest req) throws IOException, ServletException, FormException { - } - - @Override - public boolean canDelete(View view) { - return true; - } - - @Override - public void deleteView(View view) throws IOException { - views.remove(view); - } - - @Override - public Collection getViews() { - return Collections.unmodifiableList(views); - } - - @Override - public View getView(String name) { - //Top level views returned first if match - for (View v : views) { - if (v.getViewName().equals(name)) { - return v; - } - } - for (View v : views) { - if (v instanceof ViewGroup) { - View nestedView = ((ViewGroup) v).getView(name); - if (nestedView != null) { - return nestedView; - } - } - } - return null; - } - - @Override - public void onViewRenamed(View view, String oldName, String newName) { - // noop - } - - @RequirePOST - public void doCreateView( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, FormException { - checkPermission(View.CREATE); - views.add(View.create(req,rsp,this)); - save(); - } - - // this feature is not public yet - @Extension - public static ViewDescriptor register() { - if(SystemProperties.getBoolean("hudson.TreeView")) - return new DescriptorImpl(); - else - return null; - } - - public static final class DescriptorImpl extends ViewDescriptor { - @Override - public String getDisplayName() { - return "Tree View"; - } - } - - @Override - public ViewsTabBar getViewsTabBar() { - return Jenkins.get().getViewsTabBar(); - } - - @Override - public ItemGroup getItemGroup() { - return getOwner().getItemGroup(); - } - - @Override - public List getViewActions() { - return owner.getViewActions(); - } - -} diff --git a/core/src/main/resources/hudson/model/TreeView/ajaxRows.jelly b/core/src/main/resources/hudson/model/TreeView/ajaxRows.jelly deleted file mode 100644 index a6812a20cd..0000000000 --- a/core/src/main/resources/hudson/model/TreeView/ajaxRows.jelly +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - -
-
-
diff --git a/core/src/main/resources/hudson/model/TreeView/main.jelly b/core/src/main/resources/hudson/model/TreeView/main.jelly deleted file mode 100644 index 0f14902005..0000000000 --- a/core/src/main/resources/hudson/model/TreeView/main.jelly +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/core/src/main/resources/hudson/model/TreeView/newView.jelly b/core/src/main/resources/hudson/model/TreeView/newView.jelly deleted file mode 100644 index 9f22b566ac..0000000000 --- a/core/src/main/resources/hudson/model/TreeView/newView.jelly +++ /dev/null @@ -1,26 +0,0 @@ - - - - \ No newline at end of file diff --git a/core/src/main/resources/hudson/model/TreeView/newViewDetail.jelly b/core/src/main/resources/hudson/model/TreeView/newViewDetail.jelly deleted file mode 100644 index b7c7ea1666..0000000000 --- a/core/src/main/resources/hudson/model/TreeView/newViewDetail.jelly +++ /dev/null @@ -1,28 +0,0 @@ - - - -

- Experimental: show hierarchical views -
\ No newline at end of file diff --git a/core/src/main/resources/hudson/model/TreeView/sidepanel2.jelly b/core/src/main/resources/hudson/model/TreeView/sidepanel2.jelly deleted file mode 100644 index dc3d0e7938..0000000000 --- a/core/src/main/resources/hudson/model/TreeView/sidepanel2.jelly +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - diff --git a/core/src/main/resources/hudson/model/TreeView/sidepanel2_bg.properties b/core/src/main/resources/hudson/model/TreeView/sidepanel2_bg.properties deleted file mode 100644 index 6c612eb9e6..0000000000 --- a/core/src/main/resources/hudson/model/TreeView/sidepanel2_bg.properties +++ /dev/null @@ -1,24 +0,0 @@ -# The MIT License -# -# Bulgarian translation: Copyright (c) 2016, Alexander Shopov -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -New\ View=\ - \u041d\u043e\u0432 \u0438\u0437\u0433\u043b\u0435\u0434 diff --git a/core/src/main/resources/hudson/model/TreeView/sidepanel2_da.properties b/core/src/main/resources/hudson/model/TreeView/sidepanel2_da.properties deleted file mode 100644 index 448476e662..0000000000 --- a/core/src/main/resources/hudson/model/TreeView/sidepanel2_da.properties +++ /dev/null @@ -1,23 +0,0 @@ -# The MIT License -# -# Copyright (c) 2004-2010, Sun Microsystems, Inc. Kohsuke Kawaguchi. Knud Poulsen. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -New\ View=Ny visning diff --git a/core/src/main/resources/hudson/model/TreeView/sidepanel2_de.properties b/core/src/main/resources/hudson/model/TreeView/sidepanel2_de.properties deleted file mode 100644 index ce2c2658a4..0000000000 --- a/core/src/main/resources/hudson/model/TreeView/sidepanel2_de.properties +++ /dev/null @@ -1 +0,0 @@ -New\ View=Neue Ansicht diff --git a/core/src/main/resources/hudson/model/TreeView/sidepanel2_es.properties b/core/src/main/resources/hudson/model/TreeView/sidepanel2_es.properties deleted file mode 100644 index 4df3f2f531..0000000000 --- a/core/src/main/resources/hudson/model/TreeView/sidepanel2_es.properties +++ /dev/null @@ -1,23 +0,0 @@ -# The MIT License -# -# Copyright (c) 2004-2010, Sun Microsystems, Inc. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -New\ View=Nueva vista diff --git a/core/src/main/resources/hudson/model/TreeView/sidepanel2_fr.properties b/core/src/main/resources/hudson/model/TreeView/sidepanel2_fr.properties deleted file mode 100644 index f4253389b6..0000000000 --- a/core/src/main/resources/hudson/model/TreeView/sidepanel2_fr.properties +++ /dev/null @@ -1,23 +0,0 @@ -# The MIT License -# -# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Eric Lefevre-Ardant -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -New\ View=Nouvelle vue diff --git a/core/src/main/resources/hudson/model/TreeView/sidepanel2_it.properties b/core/src/main/resources/hudson/model/TreeView/sidepanel2_it.properties deleted file mode 100644 index 260b76d71e..0000000000 --- a/core/src/main/resources/hudson/model/TreeView/sidepanel2_it.properties +++ /dev/null @@ -1,24 +0,0 @@ -# The MIT License -# -# Italian localization plugin for Jenkins -# Copyright © 2020 Alessandro Menti -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -New\ View=Nuova vista diff --git a/core/src/main/resources/hudson/model/TreeView/sidepanel2_ja.properties b/core/src/main/resources/hudson/model/TreeView/sidepanel2_ja.properties deleted file mode 100644 index 78f5e6bb32..0000000000 --- a/core/src/main/resources/hudson/model/TreeView/sidepanel2_ja.properties +++ /dev/null @@ -1,23 +0,0 @@ -# The MIT License -# -# Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi, Seiji Sogabe -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -New\ View=\u65B0\u898F\u30D3\u30E5\u30FC diff --git a/core/src/main/resources/hudson/model/TreeView/sidepanel2_pt_BR.properties b/core/src/main/resources/hudson/model/TreeView/sidepanel2_pt_BR.properties deleted file mode 100644 index 6054ccefe2..0000000000 --- a/core/src/main/resources/hudson/model/TreeView/sidepanel2_pt_BR.properties +++ /dev/null @@ -1,23 +0,0 @@ -# The MIT License -# -# Copyright (c) 2004-2010, Sun Microsystems, Inc., Cleiber Silva -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -New\ View=Nova view diff --git a/core/src/main/resources/hudson/model/TreeView/sidepanel2_sr.properties b/core/src/main/resources/hudson/model/TreeView/sidepanel2_sr.properties deleted file mode 100644 index f8ec299e02..0000000000 --- a/core/src/main/resources/hudson/model/TreeView/sidepanel2_sr.properties +++ /dev/null @@ -1,3 +0,0 @@ -# This file is under the MIT License by authors - -New\ View=\u041D\u043E\u0432\u0438 \u043F\u0440\u0435\u0433\u043B\u0435\u0434 diff --git a/core/src/main/resources/hudson/model/TreeView/sidepanel2_zh_TW.properties b/core/src/main/resources/hudson/model/TreeView/sidepanel2_zh_TW.properties deleted file mode 100644 index 4d5595a242..0000000000 --- a/core/src/main/resources/hudson/model/TreeView/sidepanel2_zh_TW.properties +++ /dev/null @@ -1,23 +0,0 @@ -# The MIT License -# -# Copyright (c) 2013, Chunghwa Telecom Co., Ltd., Pei-Tang Huang -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -New\ View=\u65b0\u589e\u8996\u666f diff --git a/test/src/test/java/hudson/cli/UpdateViewCommandTest.java b/test/src/test/java/hudson/cli/UpdateViewCommandTest.java index 857b67f352..1d9c72ff1a 100644 --- a/test/src/test/java/hudson/cli/UpdateViewCommandTest.java +++ b/test/src/test/java/hudson/cli/UpdateViewCommandTest.java @@ -33,7 +33,7 @@ import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.nullValue; import hudson.model.ListView; -import hudson.model.TreeView; +import hudson.model.MyView; import hudson.model.View; import jenkins.model.Jenkins; @@ -85,8 +85,8 @@ public class UpdateViewCommandTest { } @Test public void updateViewWithWrongViewTypeShouldFail() throws Exception { - TreeView tv = new TreeView("aView"); - j.jenkins.addView(tv); + MyView myView = new MyView("aView"); + j.jenkins.addView(myView); final CLICommandInvoker.Result result = command .authorizedTo(View.READ, View.CONFIGURE, Jenkins.READ) .withStdin(this.getClass().getResourceAsStream("/hudson/cli/view.xml")) @@ -94,7 +94,7 @@ public class UpdateViewCommandTest { ; assertThat(result, failedWith(1)); - assertThat(result.stderr(), containsString("Expecting view type: "+ tv.getClass() + assertThat(result.stderr(), containsString("Expecting view type: "+ myView.getClass() + " but got: class hudson.model.ListView instead.")); }