| author | Henrik Lynggaard Hansen | 2012-07-17 16:02:20 (EDT) |
|---|---|---|
| committer | Henrik Lynggaard Hansen | 2012-07-17 16:02:20 (EDT) |
| commit | 77b5ff3a752be99483ff5e618e76d8741eede385 (patch) (side-by-side diff) | |
| tree | f64d5ddd0a9ece144c68c480f5e89d07a56d4994 | |
| parent | 825e47b2ae6a94d7be58a9f180e10928c8d62613 (diff) | |
| download | org.eclipse.hudson.core-77b5ff3a752be99483ff5e618e76d8741eede385.zip org.eclipse.hudson.core-77b5ff3a752be99483ff5e618e76d8741eede385.tar.gz org.eclipse.hudson.core-77b5ff3a752be99483ff5e618e76d8741eede385.tar.bz2 | |
Reformat hudson.views and hudson.widgetsrefs/changes/28/6828/1
Change-Id: I0dad7960bedb2ebba83306622560220111d88d8e
Signed-off-by: Henrik Lynggaard Hansen <henrik@hlyh.dk>
21 files changed, 235 insertions, 209 deletions
diff --git a/hudson-core/src/main/java/hudson/views/BuildButtonColumn.java b/hudson-core/src/main/java/hudson/views/BuildButtonColumn.java index 15622fc..3e0c307 100644 --- a/hudson-core/src/main/java/hudson/views/BuildButtonColumn.java +++ b/hudson-core/src/main/java/hudson/views/BuildButtonColumn.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: -* + * Contributors: + * * Kohsuke Kawaguchi, Martin Eigenbrodt - * + * * *******************************************************************************/ @@ -20,12 +20,14 @@ import hudson.Extension; import org.kohsuke.stapler.DataBoundConstructor; public class BuildButtonColumn extends ListViewColumn { + @DataBoundConstructor public BuildButtonColumn() { } @Extension public static class DescriptorImpl extends ListViewColumnDescriptor { + @Override public String getDisplayName() { return Messages.BuildButtonColumn_DisplayName(); diff --git a/hudson-core/src/main/java/hudson/views/ConsoleColumn.java b/hudson-core/src/main/java/hudson/views/ConsoleColumn.java index 5cc22f4..5041450 100644 --- a/hudson-core/src/main/java/hudson/views/ConsoleColumn.java +++ b/hudson-core/src/main/java/hudson/views/ConsoleColumn.java @@ -27,12 +27,14 @@ import org.kohsuke.stapler.DataBoundConstructor; * @author Nikita Levyankov */ public class ConsoleColumn extends ListViewColumn { + @DataBoundConstructor public ConsoleColumn() { } @Extension public static class DescriptorImpl extends ListViewColumnDescriptor { + @Override public String getDisplayName() { return Messages.ConsoleColumn_DisplayName(); diff --git a/hudson-core/src/main/java/hudson/views/DefaultMyViewsTabBar.java b/hudson-core/src/main/java/hudson/views/DefaultMyViewsTabBar.java index f8855e8..7a152bf 100644 --- a/hudson-core/src/main/java/hudson/views/DefaultMyViewsTabBar.java +++ b/hudson-core/src/main/java/hudson/views/DefaultMyViewsTabBar.java @@ -7,9 +7,9 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: + * * - * * Winston Prakash * *******************************************************************************/ @@ -27,17 +27,18 @@ import org.kohsuke.stapler.DataBoundConstructor; * @see MyViewsTabBar */ public class DefaultMyViewsTabBar extends MyViewsTabBar { + @DataBoundConstructor public DefaultMyViewsTabBar() { } @Extension public static class DescriptorImpl extends MyViewsTabBarDescriptor { + @Override public String getDisplayName() { return Messages.DefaultMyViewsTabsBar_DisplayName(); //return "Default My Views TabsBar"; } } - } diff --git a/hudson-core/src/main/java/hudson/views/DefaultViewsTabBar.java b/hudson-core/src/main/java/hudson/views/DefaultViewsTabBar.java index 8582bab..6196d26 100644 --- a/hudson-core/src/main/java/hudson/views/DefaultViewsTabBar.java +++ b/hudson-core/src/main/java/hudson/views/DefaultViewsTabBar.java @@ -7,9 +7,9 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: + * * - * * Winston Prakash * *******************************************************************************/ @@ -27,17 +27,18 @@ import org.kohsuke.stapler.DataBoundConstructor; * @see ViewsTabBar */ public class DefaultViewsTabBar extends ViewsTabBar { + @DataBoundConstructor public DefaultViewsTabBar() { } @Extension public static class DescriptorImpl extends ViewsTabBarDescriptor { + @Override public String getDisplayName() { return Messages.DefaultViewsTabsBar_DisplayName(); //return "Default Views TabsBar"; } } - } diff --git a/hudson-core/src/main/java/hudson/views/JobColumn.java b/hudson-core/src/main/java/hudson/views/JobColumn.java index b950720..84178a5 100644 --- a/hudson-core/src/main/java/hudson/views/JobColumn.java +++ b/hudson-core/src/main/java/hudson/views/JobColumn.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: -* -* Kohsuke Kawaguchi, Martin Eigenbrodt - * + * Contributors: + * + * Kohsuke Kawaguchi, Martin Eigenbrodt + * * *******************************************************************************/ @@ -20,16 +20,17 @@ import hudson.Extension; import org.kohsuke.stapler.DataBoundConstructor; public class JobColumn extends ListViewColumn { + @DataBoundConstructor public JobColumn() { } @Extension public static class DescriptorImpl extends ListViewColumnDescriptor { + @Override public String getDisplayName() { return Messages.JobColumn_DisplayName(); } } - } diff --git a/hudson-core/src/main/java/hudson/views/LastDurationColumn.java b/hudson-core/src/main/java/hudson/views/LastDurationColumn.java index b10eaa4..27c8548 100644 --- a/hudson-core/src/main/java/hudson/views/LastDurationColumn.java +++ b/hudson-core/src/main/java/hudson/views/LastDurationColumn.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: -* -* Kohsuke Kawaguchi, Martin Eigenbrodt - * + * Contributors: + * + * Kohsuke Kawaguchi, Martin Eigenbrodt + * * *******************************************************************************/ @@ -20,12 +20,14 @@ import hudson.Extension; import org.kohsuke.stapler.DataBoundConstructor; public class LastDurationColumn extends ListViewColumn { + @DataBoundConstructor public LastDurationColumn() { } @Extension public static class DescriptorImpl extends ListViewColumnDescriptor { + @Override public String getDisplayName() { return Messages.LastDurationColumn_DisplayName(); diff --git a/hudson-core/src/main/java/hudson/views/LastFailureColumn.java b/hudson-core/src/main/java/hudson/views/LastFailureColumn.java index 0ee7027..35ebcac 100644 --- a/hudson-core/src/main/java/hudson/views/LastFailureColumn.java +++ b/hudson-core/src/main/java/hudson/views/LastFailureColumn.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: -* -* Kohsuke Kawaguchi, Martin Eigenbrodt - * + * Contributors: + * + * Kohsuke Kawaguchi, Martin Eigenbrodt + * * *******************************************************************************/ @@ -20,12 +20,14 @@ import hudson.Extension; import org.kohsuke.stapler.DataBoundConstructor; public class LastFailureColumn extends ListViewColumn { + @DataBoundConstructor public LastFailureColumn() { } @Extension public static class DescriptorImpl extends ListViewColumnDescriptor { + @Override public String getDisplayName() { return Messages.LastFailureColumn_DisplayName(); diff --git a/hudson-core/src/main/java/hudson/views/LastStableColumn.java b/hudson-core/src/main/java/hudson/views/LastStableColumn.java index 0884210..05d0807 100644 --- a/hudson-core/src/main/java/hudson/views/LastStableColumn.java +++ b/hudson-core/src/main/java/hudson/views/LastStableColumn.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * * Jesse Glick - * + * * *******************************************************************************/ @@ -20,12 +20,14 @@ import hudson.Extension; import org.kohsuke.stapler.DataBoundConstructor; public class LastStableColumn extends ListViewColumn { + @DataBoundConstructor public LastStableColumn() { } @Extension public static class DescriptorImpl extends ListViewColumnDescriptor { + @Override public String getDisplayName() { return Messages.LastStableColumn_DisplayName(); diff --git a/hudson-core/src/main/java/hudson/views/LastSuccessColumn.java b/hudson-core/src/main/java/hudson/views/LastSuccessColumn.java index c97ff3a..ff95f74 100644 --- a/hudson-core/src/main/java/hudson/views/LastSuccessColumn.java +++ b/hudson-core/src/main/java/hudson/views/LastSuccessColumn.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: -* -* Kohsuke Kawaguchi, Martin Eigenbrodt - * + * Contributors: + * + * Kohsuke Kawaguchi, Martin Eigenbrodt + * * *******************************************************************************/ @@ -20,12 +20,14 @@ import hudson.Extension; import org.kohsuke.stapler.DataBoundConstructor; public class LastSuccessColumn extends ListViewColumn { + @DataBoundConstructor public LastSuccessColumn() { } @Extension public static class DescriptorImpl extends ListViewColumnDescriptor { + @Override public String getDisplayName() { return Messages.LastSuccessColumn_DisplayName(); diff --git a/hudson-core/src/main/java/hudson/views/ListViewColumn.java b/hudson-core/src/main/java/hudson/views/ListViewColumn.java index d0e0da8..0acd98e 100644 --- a/hudson-core/src/main/java/hudson/views/ListViewColumn.java +++ b/hudson-core/src/main/java/hudson/views/ListViewColumn.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: -* -* Kohsuke Kawaguchi, Martin Eigenbrodt - * + * Contributors: + * + * Kohsuke Kawaguchi, Martin Eigenbrodt + * * *******************************************************************************/ @@ -37,38 +37,36 @@ import java.util.logging.Level; import java.util.logging.Logger; /** - * Extension point for adding a column to a table rendering of {@link Item}s, such as {@link ListView}. + * Extension point for adding a column to a table rendering of {@link Item}s, + * such as {@link ListView}. * - * <p> - * This object must have the <tt>column.jelly</tt>. This view - * is called for each cell of this column. The {@link Item} object - * is passed in the "job" variable. The view should render - * the <td> tag. + * <p> This object must have the <tt>column.jelly</tt>. This view is called for + * each cell of this column. The {@link Item} object is passed in the "job" + * variable. The view should render the <td> tag. * - * <p> - * This object may have an additional <tt>columHeader.jelly</tt>. The default ColmnHeader - * will render {@link #getColumnCaption()}. + * <p> This object may have an additional <tt>columHeader.jelly</tt>. The + * default ColmnHeader will render {@link #getColumnCaption()}. * - * <p> - * If you opt to {@linkplain ListViewColumnDescriptor#shownByDefault() be shown by default}, - * there also must be a default constructor, which is invoked to create a list view column in - * the default configuration. + * <p> If you opt to + * {@linkplain ListViewColumnDescriptor#shownByDefault() be shown by default}, + * there also must be a default constructor, which is invoked to create a list + * view column in the default configuration. * - * <p> - * Originally, this extension point was designed for {@link ListView}, but since then - * it has grown to be applicable to other {@link View}s and {@link ItemGroup}s that render - * a collection of {@link Item}s in a tabular format. + * <p> Originally, this extension point was designed for {@link ListView}, but + * since then it has grown to be applicable to other {@link View}s and + * {@link ItemGroup}s that render a collection of {@link Item}s in a tabular + * format. * * @author Kohsuke Kawaguchi * @since 1.279 * @see ListViewColumnDescriptor */ public abstract class ListViewColumn implements ExtensionPoint, Describable<ListViewColumn> { + /** * Returns the name of the column that explains what this column means * - * @return - * The convention is to use capitalization like "Foo Bar Zot". + * @return The convention is to use capitalization like "Foo Bar Zot". */ @Exported public String getColumnCaption() { @@ -81,36 +79,39 @@ public abstract class ListViewColumn implements ExtensionPoint, Describable<List public static DescriptorExtensionList<ListViewColumn, Descriptor<ListViewColumn>> all() { return Hudson.getInstance().<ListViewColumn, Descriptor<ListViewColumn>>getDescriptorList(ListViewColumn.class); } - /** * All registered {@link ListViewColumn}s. - * @deprecated as of 1.281 - * Use {@link #all()} for read access and {@link Extension} for registration. + * + * @deprecated as of 1.281 Use {@link #all()} for read access and + * {@link Extension} for registration. */ public static final DescriptorList<ListViewColumn> LIST = new DescriptorList<ListViewColumn>(ListViewColumn.class); /** - * Whether this column will be shown by default. - * The default implementation is true. + * Whether this column will be shown by default. The default implementation + * is true. * * @since 1.301 - * @deprecated as of 1.342. - * Use {@link ListViewColumnDescriptor#shownByDefault()} + * @deprecated as of 1.342. Use + * {@link ListViewColumnDescriptor#shownByDefault()} */ public boolean shownByDefault() { return true; } /** - * For compatibility reason, this method may not return a {@link ListViewColumnDescriptor} - * and instead return a plain {@link Descriptor} instance. + * For compatibility reason, this method may not return a + * {@link ListViewColumnDescriptor} and instead return a plain + * {@link Descriptor} instance. */ public Descriptor<ListViewColumn> getDescriptor() { return Hudson.getInstance().getDescriptorOrDie(getClass()); } /** - * Creates the list of {@link ListViewColumn}s to be used for newly created {@link ListView}s and their likes. + * Creates the list of {@link ListViewColumn}s to be used for newly created + * {@link ListView}s and their likes. + * * @since 1.391 */ public static List<ListViewColumn> createDefaultInitialColumnList() { @@ -120,47 +121,49 @@ public abstract class ListViewColumn implements ExtensionPoint, Describable<List DescriptorExtensionList<ListViewColumn, Descriptor<ListViewColumn>> all = ListViewColumn.all(); ArrayList<Descriptor<ListViewColumn>> left = new ArrayList<Descriptor<ListViewColumn>>(all); - for (Class<? extends ListViewColumn> d: DEFAULT_COLUMNS) { + for (Class<? extends ListViewColumn> d : DEFAULT_COLUMNS) { Descriptor<ListViewColumn> des = all.find(d); - if (des != null) { + if (des != null) { try { r.add(des.newInstance(null, null)); left.remove(des); } catch (FormException e) { - LOGGER.log(Level.WARNING, "Failed to instantiate "+des.clazz,e); + LOGGER.log(Level.WARNING, "Failed to instantiate " + des.clazz, e); } } } - for (Descriptor<ListViewColumn> d : left) + for (Descriptor<ListViewColumn> d : left) { try { if (d instanceof ListViewColumnDescriptor) { ListViewColumnDescriptor ld = (ListViewColumnDescriptor) d; - if (!ld.shownByDefault()) continue; // skip this + if (!ld.shownByDefault()) { + continue; // skip this + } } ListViewColumn lvc = d.newInstance(null, null); - if (!lvc.shownByDefault()) continue; // skip this - + if (!lvc.shownByDefault()) { + continue; // skip this + } r.add(lvc); } catch (FormException e) { - LOGGER.log(Level.WARNING, "Failed to instantiate "+d.clazz,e); + LOGGER.log(Level.WARNING, "Failed to instantiate " + d.clazz, e); } + } return r; } - /** - * Traditional column layout before the {@link ListViewColumn} becomes extensible. + * Traditional column layout before the {@link ListViewColumn} becomes + * extensible. */ - private static final List<Class<? extends ListViewColumn>> DEFAULT_COLUMNS = Arrays.asList( - StatusColumn.class, - WeatherColumn.class, - JobColumn.class, - LastSuccessColumn.class, - LastFailureColumn.class, - LastDurationColumn.class, - ConsoleColumn.class, - BuildButtonColumn.class - ); - + private static final List<Class<? extends ListViewColumn>> DEFAULT_COLUMNS = Arrays.asList( + StatusColumn.class, + WeatherColumn.class, + JobColumn.class, + LastSuccessColumn.class, + LastFailureColumn.class, + LastDurationColumn.class, + ConsoleColumn.class, + BuildButtonColumn.class); private static final Logger LOGGER = Logger.getLogger(ListViewColumn.class.getName()); } diff --git a/hudson-core/src/main/java/hudson/views/ListViewColumnDescriptor.java b/hudson-core/src/main/java/hudson/views/ListViewColumnDescriptor.java index 37c705f..5dbac76 100644 --- a/hudson-core/src/main/java/hudson/views/ListViewColumnDescriptor.java +++ b/hudson-core/src/main/java/hudson/views/ListViewColumnDescriptor.java @@ -8,7 +8,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * + * * *******************************************************************************/ @@ -21,18 +21,20 @@ import org.kohsuke.stapler.DataBoundConstructor; /** * {@link Descriptor} for {@link ListViewColumn}. * - * <p> - * {@link ListViewColumnDescriptor} can have the associated {@code config.jelly}, which will be rendered - * in the view configuration page. When the configuration page is submitted, a new instance of - * {@link ListViewColumn} will be created based on the submitted form, via {@link DataBoundConstructor}. + * <p> {@link ListViewColumnDescriptor} can have the associated + * {@code config.jelly}, which will be rendered in the view configuration page. + * When the configuration page is submitted, a new instance of + * {@link ListViewColumn} will be created based on the submitted form, via + * {@link DataBoundConstructor}. * * @author Kohsuke Kawaguchi * @since 1.342 */ public abstract class ListViewColumnDescriptor extends Descriptor<ListViewColumn> { + /** - * Whether this column will be shown by default on new/existing {@link ListView}s. - * The default implementation is true. + * Whether this column will be shown by default on new/existing + * {@link ListView}s. The default implementation is true. * * @since 1.342 */ diff --git a/hudson-core/src/main/java/hudson/views/MyViewsTabBar.java b/hudson-core/src/main/java/hudson/views/MyViewsTabBar.java index 1b7cca5..9f04ec8 100644 --- a/hudson-core/src/main/java/hudson/views/MyViewsTabBar.java +++ b/hudson-core/src/main/java/hudson/views/MyViewsTabBar.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * * Winston Prakash - * + * * *******************************************************************************/ @@ -24,22 +24,22 @@ import hudson.model.Hudson; import hudson.model.MyViewsProperty; /** - * Extension point for adding a MyViewsTabBar header to Projects {@link MyViewsProperty}. + * Extension point for adding a MyViewsTabBar header to Projects + * {@link MyViewsProperty}. * - * <p> - * This object must have the <tt>myViewTabs.jelly</tt>. This view - * is called once when the My Views main panel is built. - * The "views" attribute is set to the "Collection of views". + * <p> This object must have the <tt>myViewTabs.jelly</tt>. This view is called + * once when the My Views main panel is built. The "views" attribute is set to + * the "Collection of views". * - * <p> - * There also must be a default constructor, which is invoked to create a My Views TabBar in - * the default configuration. + * <p> There also must be a default constructor, which is invoked to create a My + * Views TabBar in the default configuration. * * @author Winston Prakash * @since 1.378 * @see MyViewsTabBarDescriptor */ public abstract class MyViewsTabBar extends AbstractDescribableImpl<MyViewsTabBar> implements ExtensionPoint { + /** * Returns all the registered {@link ListViewColumn} descriptors. */ @@ -48,6 +48,6 @@ public abstract class MyViewsTabBar extends AbstractDescribableImpl<MyViewsTabBa } public MyViewsTabBarDescriptor getDescriptor() { - return (MyViewsTabBarDescriptor)super.getDescriptor(); + return (MyViewsTabBarDescriptor) super.getDescriptor(); } } diff --git a/hudson-core/src/main/java/hudson/views/MyViewsTabBarDescriptor.java b/hudson-core/src/main/java/hudson/views/MyViewsTabBarDescriptor.java index d8aa83d..5712870 100644 --- a/hudson-core/src/main/java/hudson/views/MyViewsTabBarDescriptor.java +++ b/hudson-core/src/main/java/hudson/views/MyViewsTabBarDescriptor.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * * Winston Prakash - * + * * *******************************************************************************/ diff --git a/hudson-core/src/main/java/hudson/views/StatusColumn.java b/hudson-core/src/main/java/hudson/views/StatusColumn.java index b3bad94..fe3e9e9 100644 --- a/hudson-core/src/main/java/hudson/views/StatusColumn.java +++ b/hudson-core/src/main/java/hudson/views/StatusColumn.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: -* -* Kohsuke Kawaguchi, Martin Eigenbrodt - * + * Contributors: + * + * Kohsuke Kawaguchi, Martin Eigenbrodt + * * *******************************************************************************/ @@ -26,16 +26,17 @@ import org.kohsuke.stapler.DataBoundConstructor; * @see StatusIcon */ public class StatusColumn extends ListViewColumn { + @DataBoundConstructor public StatusColumn() { } @Extension public static class DescriptorImpl extends ListViewColumnDescriptor { + @Override public String getDisplayName() { return Messages.StatusColumn_DisplayName(); } } - } diff --git a/hudson-core/src/main/java/hudson/views/ViewJobFilter.java b/hudson-core/src/main/java/hudson/views/ViewJobFilter.java index 419f5b5..519374b 100644 --- a/hudson-core/src/main/java/hudson/views/ViewJobFilter.java +++ b/hudson-core/src/main/java/hudson/views/ViewJobFilter.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * * Kohsuke Kawaguchi, Martin Eigenbrodt - * + * * *******************************************************************************/ @@ -27,7 +27,8 @@ import hudson.model.View; import java.util.List; /** - * Each ViewJobFilter contributes to or removes from the list of Jobs for a view. + * Each ViewJobFilter contributes to or removes from the list of Jobs for a + * view. * * @author Jacob Robertson */ @@ -41,16 +42,19 @@ public abstract class ViewJobFilter implements ExtensionPoint, Describable<ViewJ } @SuppressWarnings("unchecked") - public Descriptor<ViewJobFilter> getDescriptor() { + public Descriptor<ViewJobFilter> getDescriptor() { return Hudson.getInstance().getDescriptorOrDie(getClass()); } - + /** * Choose which jobs to show for a view. - * @param added which jobs have been added so far. This JobFilter can remove or add to this list. + * + * @param added which jobs have been added so far. This JobFilter can remove + * or add to this list. * @param all All jobs that are possible. * @param filteringView The view that we are filtering jobs for. - * @return a new list based off of the jobs added so far, and all jobs available. + * @return a new list based off of the jobs added so far, and all jobs + * available. */ abstract public List<TopLevelItem> filter(List<TopLevelItem> added, List<TopLevelItem> all, View filteringView); } diff --git a/hudson-core/src/main/java/hudson/views/ViewsTabBar.java b/hudson-core/src/main/java/hudson/views/ViewsTabBar.java index 19fdf63..f236dd7 100644 --- a/hudson-core/src/main/java/hudson/views/ViewsTabBar.java +++ b/hudson-core/src/main/java/hudson/views/ViewsTabBar.java @@ -7,9 +7,9 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: + * * - * * Winston Prakash * *******************************************************************************/ @@ -26,20 +26,19 @@ import hudson.model.ListView; /** * Extension point for adding a ViewsTabBar header to Projects {@link ListView}. * - * <p> - * This object must have the <tt>viewTabs.jelly</tt>. This view - * is called once when the project views main panel is built. - * The "views" attribute is set to the "Collection of views". + * <p> This object must have the <tt>viewTabs.jelly</tt>. This view is called + * once when the project views main panel is built. The "views" attribute is set + * to the "Collection of views". * - * <p> - * There also must be a default constructor, which is invoked to create a Views TabBar in - * the default configuration. + * <p> There also must be a default constructor, which is invoked to create a + * Views TabBar in the default configuration. * * @author Winston Prakash * @since 1.381 * @see ViewsTabBarDescriptor */ public abstract class ViewsTabBar extends AbstractDescribableImpl<ViewsTabBar> implements ExtensionPoint { + /** * Returns all the registered {@link ViewsTabBar} descriptors. */ @@ -49,6 +48,6 @@ public abstract class ViewsTabBar extends AbstractDescribableImpl<ViewsTabBar> i @Override public ViewsTabBarDescriptor getDescriptor() { - return (ViewsTabBarDescriptor)super.getDescriptor(); + return (ViewsTabBarDescriptor) super.getDescriptor(); } } diff --git a/hudson-core/src/main/java/hudson/views/ViewsTabBarDescriptor.java b/hudson-core/src/main/java/hudson/views/ViewsTabBarDescriptor.java index 38a6084..4f98d57 100644 --- a/hudson-core/src/main/java/hudson/views/ViewsTabBarDescriptor.java +++ b/hudson-core/src/main/java/hudson/views/ViewsTabBarDescriptor.java @@ -7,9 +7,9 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: + * * - * * Winston Prakash * *******************************************************************************/ diff --git a/hudson-core/src/main/java/hudson/views/WeatherColumn.java b/hudson-core/src/main/java/hudson/views/WeatherColumn.java index 98c292b..2564a1c 100644 --- a/hudson-core/src/main/java/hudson/views/WeatherColumn.java +++ b/hudson-core/src/main/java/hudson/views/WeatherColumn.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: -* -* Kohsuke Kawaguchi, Martin Eigenbrodt - * + * Contributors: + * + * Kohsuke Kawaguchi, Martin Eigenbrodt + * * *******************************************************************************/ @@ -20,16 +20,17 @@ import hudson.Extension; import org.kohsuke.stapler.DataBoundConstructor; public class WeatherColumn extends ListViewColumn { + @DataBoundConstructor public WeatherColumn() { } @Extension public static class DescriptorImpl extends ListViewColumnDescriptor { + @Override public String getDisplayName() { return Messages.WeatherColumn_DisplayName(); } } - } diff --git a/hudson-core/src/main/java/hudson/widgets/BuildHistoryWidget.java b/hudson-core/src/main/java/hudson/widgets/BuildHistoryWidget.java index ec7e857..cac30a3 100644 --- a/hudson-core/src/main/java/hudson/widgets/BuildHistoryWidget.java +++ b/hudson-core/src/main/java/hudson/widgets/BuildHistoryWidget.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: -* -* Kohsuke Kawaguchi - * + * Contributors: + * + * Kohsuke Kawaguchi + * * *******************************************************************************/ @@ -27,34 +27,35 @@ import java.util.List; /** * Displays the build history on the side panel. * - * <p> - * This widget enhances {@link HistoryWidget} by groking the notion - * that {@link #owner} can be in the queue toward the next build. + * <p> This widget enhances {@link HistoryWidget} by groking the notion that + * {@link #owner} can be in the queue toward the next build. * * @author Kohsuke Kawaguchi */ -public class BuildHistoryWidget<T> extends HistoryWidget<Task,T> { +public class BuildHistoryWidget<T> extends HistoryWidget<Task, T> { + /** - * @param owner - * The parent model object that owns this widget. + * @param owner The parent model object that owns this widget. */ - public BuildHistoryWidget(Task owner, Iterable<T> baseList,Adapter<? super T> adapter) { - super(owner,baseList, adapter); + public BuildHistoryWidget(Task owner, Iterable<T> baseList, Adapter<? super T> adapter) { + super(owner, baseList, adapter); } /** - * Returns the first queue item if the owner is scheduled for execution in the queue. + * Returns the first queue item if the owner is scheduled for execution in + * the queue. */ public Item getQueuedItem() { return Hudson.getInstance().getQueue().getItem(owner); } /** - * Returns the queue item if the owner is scheduled for execution in the queue, in REVERSE ORDER + * Returns the queue item if the owner is scheduled for execution in the + * queue, in REVERSE ORDER */ public List<Item> getQueuedItems() { - List<Item> list = new ArrayList<Item>(Hudson.getInstance().getQueue().getItems(owner)); - Collections.reverse(list); - return list; + List<Item> list = new ArrayList<Item>(Hudson.getInstance().getQueue().getItems(owner)); + Collections.reverse(list); + return list; } } diff --git a/hudson-core/src/main/java/hudson/widgets/HistoryWidget.java b/hudson-core/src/main/java/hudson/widgets/HistoryWidget.java index 0bbb1d7..202ae9e 100644 --- a/hudson-core/src/main/java/hudson/widgets/HistoryWidget.java +++ b/hudson-core/src/main/java/hudson/widgets/HistoryWidget.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: -* -* Kohsuke Kawaguchi - * + * Contributors: + * + * Kohsuke Kawaguchi + * * *******************************************************************************/ @@ -33,51 +33,44 @@ import java.util.List; /** * Displays the history of records (normally {@link Run}s) on the side panel. * - * @param <O> - * Owner of the widget. - * @param <T> - * Type individual record. + * @param <O> Owner of the widget. + * @param <T> Type individual record. * @author Kohsuke Kawaguchi */ -public class HistoryWidget<O extends ModelObject,T> extends Widget { +public class HistoryWidget<O extends ModelObject, T> extends Widget { + /** * The given data model of records. Newer ones first. */ //TODO: review and check whether we can do it private public Iterable<T> baseList; - /** * Indicates the next build number that client ajax should fetch. */ private String nextBuildNumberToFetch; - /** * URL of the {@link #owner}. */ //TODO: review and check whether we can do it private public final String baseUrl; - //TODO: review and check whether we can do it private public final O owner; - private boolean trimmed; - //TODO: review and check whether we can do it private public final Adapter<? super T> adapter; - /** - * First transient build record. Everything >= this will be discarded when AJAX call is made. + * First transient build record. Everything >= this will be discarded when + * AJAX call is made. */ private String firstTransientBuildKey; /** - * @param owner - * The parent model object that owns this widget. + * @param owner The parent model object that owns this widget. */ public HistoryWidget(O owner, Iterable<T> baseList, Adapter<? super T> adapter) { this.adapter = adapter; this.baseList = baseList; - this.baseUrl = Functions.getNearestAncestorUrl(Stapler.getCurrentRequest(),owner); + this.baseUrl = Functions.getNearestAncestorUrl(Stapler.getCurrentRequest(), owner); this.owner = owner; } @@ -114,10 +107,12 @@ public class HistoryWidget<O extends ModelObject,T> extends Widget { } private Iterable<T> updateFirstTransientBuildKey(Iterable<T> source) { - String key=null; - for (T t : source) - if(adapter.isBuilding(t)) + String key = null; + for (T t : source) { + if (adapter.isBuilding(t)) { key = adapter.getKey(t); + } + } firstTransientBuildKey = key; return source; } @@ -126,24 +121,27 @@ public class HistoryWidget<O extends ModelObject,T> extends Widget { * The records to be rendered this time. */ public Iterable<T> getRenderList() { - if(trimmed) { + if (trimmed) { List<T> lst; if (baseList instanceof List) { lst = (List<T>) baseList; - if(lst.size()>THRESHOLD) - return updateFirstTransientBuildKey(lst.subList(0,THRESHOLD)); - trimmed=false; + if (lst.size() > THRESHOLD) { + return updateFirstTransientBuildKey(lst.subList(0, THRESHOLD)); + } + trimmed = false; return updateFirstTransientBuildKey(lst); } else { lst = new ArrayList<T>(THRESHOLD); Iterator<T> itr = baseList.iterator(); - while(lst.size()<=THRESHOLD && itr.hasNext()) + while (lst.size() <= THRESHOLD && itr.hasNext()) { lst.add(itr.next()); + } trimmed = itr.hasNext(); // if we don't have enough items in the base list, setting this to false will optimize the next getRenderList() invocation. return updateFirstTransientBuildKey(lst); } - } else + } else { return updateFirstTransientBuildKey(baseList); + } } public boolean isTrimmed() { @@ -157,48 +155,48 @@ public class HistoryWidget<O extends ModelObject,T> extends Widget { /** * Handles AJAX requests from browsers to update build history. * - * @param n - * The build 'number' to fetch. This is string because various variants - * uses non-numbers as the build key. + * @param n The build 'number' to fetch. This is string because various + * variants uses non-numbers as the build key. */ - public void doAjax( StaplerRequest req, StaplerResponse rsp, - @Header("n") String n ) throws IOException, ServletException { + public void doAjax(StaplerRequest req, StaplerResponse rsp, + @Header("n") String n) throws IOException, ServletException { rsp.setContentType("text/html;charset=UTF-8"); // pick up builds to send back List<T> items = new ArrayList<T>(); - String nn=null; // we'll compute next n here + String nn = null; // we'll compute next n here // list up all builds >=n. for (T t : baseList) { - if(adapter.compare(t,n)>=0) { + if (adapter.compare(t, n) >= 0) { items.add(t); - if(adapter.isBuilding(t)) + if (adapter.isBuilding(t)) { nn = adapter.getKey(t); // the next fetch should start from youngest build in progress - } else + } + } else { break; + } } - if (nn==null) { + if (nn == null) { if (items.isEmpty()) { // nothing to report back. next fetch should retry the same 'n' - nn=n; + nn = n; } else { // every record fetched this time is frozen. next fetch should start from the next build - nn=adapter.getNextKey(adapter.getKey(items.get(0))); + nn = adapter.getNextKey(adapter.getKey(items.get(0))); } } baseList = items; - rsp.setHeader("n",nn); + rsp.setHeader("n", nn); firstTransientBuildKey = nn; // all builds >= nn should be marked transient - req.getView(this,"ajaxBuildHistory.jelly").forward(req,rsp); + req.getView(this, "ajaxBuildHistory.jelly").forward(req, rsp); } - private static final int THRESHOLD = 30; public String getNextBuildNumberToFetch() { @@ -210,12 +208,16 @@ public class HistoryWidget<O extends ModelObject,T> extends Widget { } public interface Adapter<T> { + /** * If record is newer than the key, return a positive number. */ int compare(T record, String key); + String getKey(T record); + boolean isBuilding(T record); + String getNextKey(String key); } } diff --git a/hudson-core/src/main/java/hudson/widgets/Widget.java b/hudson-core/src/main/java/hudson/widgets/Widget.java index b17ab86..9b141ba 100644 --- a/hudson-core/src/main/java/hudson/widgets/Widget.java +++ b/hudson-core/src/main/java/hudson/widgets/Widget.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: -* + * Contributors: + * * Kohsuke Kawaguchi - * + * * *******************************************************************************/ @@ -22,31 +22,29 @@ import hudson.model.Hudson; /** * Box to be rendered in the side panel. * - * <h2>Views</h2> - * <ul> - * <li><b>index.jelly</b> should display the widget. It should have: - * <l:pane width="2" title="..."> ...body... </l:pane> structure. + * <h2>Views</h2> <ul> <li><b>index.jelly</b> should display the widget. It + * should have: <l:pane width="2" title="..."> ...body... </l:pane> + * structure. * * @author Kohsuke Kawaguchi * @since 1.146 - * @see Hudson#getWidgets() + * @see Hudson#getWidgets() */ public abstract class Widget implements ExtensionPoint { + /** * Gets the URL path name. * - * <p> - * For example, if this method returns "xyz", and if the parent object - * (that this widget is associated with) is bound to /foo/bar/zot, - * then this widget object will be exposed to /foo/bar/zot/xyz. + * <p> For example, if this method returns "xyz", and if the parent object + * (that this widget is associated with) is bound to /foo/bar/zot, then this + * widget object will be exposed to /foo/bar/zot/xyz. * - * <p> - * This method is useful when the widget needs to expose additional URLs, - * for example for serving AJAX requests. + * <p> This method is useful when the widget needs to expose additional + * URLs, for example for serving AJAX requests. * - * <p> - * This method should return a string that's unique among other {@link Widget}s. - * The default implementation returns the unqualified class name. + * <p> This method should return a string that's unique among other + * {@link Widget}s. The default implementation returns the unqualified class + * name. */ public String getUrlName() { return getClass().getSimpleName(); |

