2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
24 import jalview.util.MessageManager;
26 import java.util.ArrayList;
27 import java.util.List;
30 * UrlLink table row definition
36 public class UrlLinkDisplay
38 private String id; // id is not supplied to display, but used to identify
45 private boolean isDefault;
47 private boolean isSelected;
49 // Headers for columns in table
50 private final static List<String> colNames = new ArrayList<String>()
53 add(MessageManager.formatMessage("label.name"));
54 add(MessageManager.formatMessage("label.url"));
55 add(MessageManager.formatMessage("label.inmenu"));
56 add(MessageManager.formatMessage("label.default"));
57 add(MessageManager.formatMessage("label.id"));
62 public final static int NAME = 0;
64 public final static int URL = 1;
66 public final static int SELECTED = 2;
68 public final static int DEFAULT = 3;
70 public final static int ID = 4;
72 public UrlLinkDisplay(String rowId, String rowName, String rowUrl,
73 boolean rowSelected, boolean rowDefault)
78 isDefault = rowDefault;
79 isSelected = rowSelected;
88 public String getName()
93 public String getUrl()
98 public boolean getIsDefault()
103 public boolean getIsSelected()
108 public void setUrl(String rowUrl)
113 public void setIsDefault(boolean rowDefault)
115 isDefault = rowDefault;
118 public void setIsSelected(boolean rowSelected)
120 isSelected = rowSelected;
123 public Object getValue(int index)
142 public void setValue(int index, Object value)
150 url = (String) value;
153 isDefault = (boolean) value;
156 isSelected = (boolean) value;
159 name = (String) value;
167 * Identify editable columns
171 * @return whether column can be edited in table
173 public boolean isEditable(int index)
175 return ((index == DEFAULT) || (index == SELECTED));
179 * Get list of column names to display in UI
181 * @return column names
183 public static List<String> getDisplayColumnNames()
185 // Display names between NAME and ID (excludes ID)
186 return colNames.subList(NAME, ID);