From 5c13e1d14e263a6bfbb533d09adb61632aa01326 Mon Sep 17 00:00:00 2001 From: Kohsuke Kawaguchi Date: Sun, 10 Jul 2011 13:54:33 -0700 Subject: [PATCH] ported over to Groovy, during the interactive session with wolfs --- core/src/main/java/hudson/model/ListView.java | 1 - core/src/main/java/hudson/model/View.java | 18 +++++++ .../resources/hudson/model/View/main.groovy | 23 ++++++++ .../resources/hudson/model/View/main.jelly | 52 ------------------- .../resources/lib/hudson/projectView.jelly | 2 +- 5 files changed, 42 insertions(+), 54 deletions(-) create mode 100644 core/src/main/resources/hudson/model/View/main.groovy delete mode 100644 core/src/main/resources/hudson/model/View/main.jelly diff --git a/core/src/main/java/hudson/model/ListView.java b/core/src/main/java/hudson/model/ListView.java index 2937955517..581ef35b27 100644 --- a/core/src/main/java/hudson/model/ListView.java +++ b/core/src/main/java/hudson/model/ListView.java @@ -123,7 +123,6 @@ public class ListView extends View implements Saveable { return jobFilters; } - @WithBridgeMethods(Iterable.class) public DescribableList> getColumns() { return columns; } diff --git a/core/src/main/java/hudson/model/View.java b/core/src/main/java/hudson/model/View.java index 6ab753e3c2..e21b3a5ac3 100644 --- a/core/src/main/java/hudson/model/View.java +++ b/core/src/main/java/hudson/model/View.java @@ -26,7 +26,9 @@ package hudson.model; import hudson.DescriptorExtensionList; import hudson.Extension; import hudson.ExtensionPoint; +import hudson.Indenter; import hudson.Util; +import hudson.matrix.Layouter.Column; import hudson.model.Descriptor.FormException; import hudson.model.Node.Mode; import hudson.model.labels.LabelAtomPropertyDescriptor; @@ -42,6 +44,7 @@ import hudson.util.AlternativeUiTextProvider.Message; import hudson.util.DescribableList; import hudson.util.DescriptorList; import hudson.util.RunList; +import hudson.views.ListViewColumn; import hudson.widgets.Widget; import jenkins.model.Jenkins; import net.sf.json.JSONObject; @@ -335,6 +338,21 @@ public abstract class View extends AbstractModelObject implements AccessControll return Collections.unmodifiableList(Jenkins.getInstance().getWidgets()); } + /** + * If this view uses <t:projectView> for rendering, this method returns columns to be displayed. + */ + public Iterable getColumns() { + return ListViewColumn.createDefaultInitialColumnList(); + } + + /** + * If this view uses <t:projectView> for rendering, this method returns the indenter used + * to indent each row. + */ + public Indenter getIndenter() { + return null; + } + /** * If true, this is a view that renders the top page of Hudson. */ diff --git a/core/src/main/resources/hudson/model/View/main.groovy b/core/src/main/resources/hudson/model/View/main.groovy new file mode 100644 index 0000000000..30ed5d86f4 --- /dev/null +++ b/core/src/main/resources/hudson/model/View/main.groovy @@ -0,0 +1,23 @@ +package hudson.model.View; + +t=namespace(lib.JenkinsTagLib) +st=namespace("jelly:stapler") + +if (items.isEmpty()) { + if (app.items.size() != 0) { + context.variables["views"] = my.owner.views; + context.variables["currentView"] = my; + st.include(page: "viewTabs.jelly", it: my.owner.viewsTabBar); + } + st.include(page: "noJob.jelly"); +} else { + t.projectView(jobs: items, jobBaseUrl: "", showViewTabs: true, columnExtensions: my.columns, indenter: my.indenter) { + context.variables["currentView"] = my; + context.variables["views"] = my.owner.views; + if (my.owner.class == hudson.model.MyViewsProperty.class) { + st.include(page: "myViewTabs.jelly", 'it': my.owner?.myViewsTabBar); + } else { + st.include(page: "viewTabs.jelly", 'it': my.owner.viewsTabBar); + } + } +} \ No newline at end of file diff --git a/core/src/main/resources/hudson/model/View/main.jelly b/core/src/main/resources/hudson/model/View/main.jelly deleted file mode 100644 index 51fd27bbc9..0000000000 --- a/core/src/main/resources/hudson/model/View/main.jelly +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/core/src/main/resources/lib/hudson/projectView.jelly b/core/src/main/resources/lib/hudson/projectView.jelly index b075ded2dd..f0a1964782 100644 --- a/core/src/main/resources/lib/hudson/projectView.jelly +++ b/core/src/main/resources/lib/hudson/projectView.jelly @@ -54,7 +54,7 @@ THE SOFTWARE. - + -- GitLab