From: kiramt Date: Mon, 5 Jun 2017 13:19:58 +0000 (+0100) Subject: JAL-2586 Checkstyle flagged fix of unintended fall through X-Git-Tag: Release_2_10_2~3^2~22^2~1 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=5b353114581d75bc703c544618e29648241a80ce;p=jalview.git JAL-2586 Checkstyle flagged fix of unintended fall through --- diff --git a/src/jalview/urls/UrlLinkDisplay.java b/src/jalview/urls/UrlLinkDisplay.java index 0eabff7..5b376a2 100644 --- a/src/jalview/urls/UrlLinkDisplay.java +++ b/src/jalview/urls/UrlLinkDisplay.java @@ -36,17 +36,22 @@ import java.util.List; public class UrlLinkDisplay { - private String id; // id is not supplied to display, but used to identify - // entries when saved + // column positions + public static final int DATABASE = 0; - private boolean isPrimary; + public static final int NAME = 1; - private boolean isSelected; + public static final int URL = 2; - private UrlLink link; + public static final int SELECTED = 3; + + public static final int PRIMARY = 4; + + public static final int ID = 5; // Headers for columns in table - private final static List colNames = new ArrayList() + @SuppressWarnings("serial") + private static final List COLNAMES = new ArrayList() { { add(MessageManager.formatMessage("label.database")); @@ -58,18 +63,14 @@ public class UrlLinkDisplay } }; - // column positions - public final static int DATABASE = 0; - - public final static int NAME = 1; - - public final static int URL = 2; + private String id; // id is not supplied to display, but used to identify + // entries when saved - public final static int SELECTED = 3; + private boolean isPrimary; - public final static int PRIMARY = 4; + private boolean isSelected; - public final static int ID = 5; + private UrlLink link; public UrlLinkDisplay(String rowId, UrlLink rowLink, boolean rowSelected, boolean rowDefault) @@ -176,6 +177,7 @@ public class UrlLinkDisplay break; case NAME: setDescription((String) value); + break; case DATABASE: setDBName((String) value); break; @@ -199,13 +201,9 @@ public class UrlLinkDisplay // so only allow editing if it is not return (!link.usesDBAccession()); } - else if (index == SELECTED) - { - return true; - } else { - return false; + return index == SELECTED; } } @@ -217,6 +215,6 @@ public class UrlLinkDisplay public static List getDisplayColumnNames() { // Display names between DESCRIPTION and ID (excludes ID) - return colNames.subList(DATABASE, ID); + return COLNAMES.subList(DATABASE, ID); } } diff --git a/test/jalview/urls/UrlLinkDisplayTest.java b/test/jalview/urls/UrlLinkDisplayTest.java index 8c50082..ff7d957 100644 --- a/test/jalview/urls/UrlLinkDisplayTest.java +++ b/test/jalview/urls/UrlLinkDisplayTest.java @@ -131,6 +131,7 @@ public class UrlLinkDisplayTest { u.setValue(UrlLinkDisplay.NAME, "New Desc"); Assert.assertEquals(u.getValue(UrlLinkDisplay.NAME), "New Desc"); + Assert.assertEquals(u.getValue(UrlLinkDisplay.DATABASE), "TestDB"); u.setValue(UrlLinkDisplay.DATABASE, "NewName"); Assert.assertEquals(u.getValue(UrlLinkDisplay.DATABASE), "NewName");