From: gmungoc Date: Fri, 24 Nov 2017 14:42:08 +0000 (+0000) Subject: JAL-2808 relocate constants for compiler, add COLUMN_COUNT constant X-Git-Tag: Release_2_11_0~102 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=70713200207901d3870e24627927aac470bfa926;p=jalview.git JAL-2808 relocate constants for compiler, add COLUMN_COUNT constant --- diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index 0c4cd56..4b4f363 100644 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -20,11 +20,6 @@ */ package jalview.gui; -import static jalview.gui.FeatureSettings.FeatureTableModel.COLOUR_COLUMN; -import static jalview.gui.FeatureSettings.FeatureTableModel.FILTER_COLUMN; -import static jalview.gui.FeatureSettings.FeatureTableModel.SHOW_COLUMN; -import static jalview.gui.FeatureSettings.FeatureTableModel.TYPE_COLUMN; - import jalview.api.FeatureColourI; import jalview.api.FeatureSettingsControllerI; import jalview.bin.Cache; @@ -110,6 +105,17 @@ import javax.swing.table.TableColumn; public class FeatureSettings extends JPanel implements FeatureSettingsControllerI { + /* + * column indices of fields in Feature Settings table + */ + static final int TYPE_COLUMN = 0; + + static final int COLOUR_COLUMN = 1; + + static final int FILTER_COLUMN = 2; + + static final int SHOW_COLUMN = 3; + private static final int COLUMN_COUNT = 4; private static final int MIN_WIDTH = 400; @@ -648,8 +654,7 @@ public class FeatureSettings extends JPanel } } - int columnCount = COLUMN_COUNT; - Object[][] data = new Object[displayableTypes.size()][columnCount]; + Object[][] data = new Object[displayableTypes.size()][COLUMN_COUNT]; int dataIndex = 0; if (fr.hasRenderOrder()) @@ -712,11 +717,10 @@ public class FeatureSettings extends JPanel if (originalData == null) { - int size = data[0].length; - originalData = new Object[data.length][size]; + originalData = new Object[data.length][COLUMN_COUNT]; for (int i = 0; i < data.length; i++) { - System.arraycopy(data[i], 0, originalData[i], 0, size); + System.arraycopy(data[i], 0, originalData[i], 0, COLUMN_COUNT); } } else @@ -787,11 +791,12 @@ public class FeatureSettings extends JPanel /* * new feature detected - add to original data (on top) */ - int size = currentData[0].length; - Object[][] newData = new Object[originalData.length + 1][size]; + Object[][] newData = new Object[originalData.length + + 1][COLUMN_COUNT]; for (int i = 0; i < originalData.length; i++) { - System.arraycopy(originalData[i], 0, newData[i + 1], 0, size); + System.arraycopy(originalData[i], 0, newData[i + 1], 0, + COLUMN_COUNT); } newData[0] = row; originalData = newData; @@ -1509,17 +1514,6 @@ public class FeatureSettings extends JPanel // /////////////////////////////////////////////////////////////////////// class FeatureTableModel extends AbstractTableModel { - /* - * column indices of fields in Feature Settings table - */ - static final int TYPE_COLUMN = 0; - - static final int COLOUR_COLUMN = 1; - - static final int FILTER_COLUMN = 2; - - static final int SHOW_COLUMN = 3; - private String[] columnNames = { MessageManager.getString("label.feature_type"), MessageManager.getString("action.colour"),