/* * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) * Copyright (C) $$Year-Rel$$ The Jalview Authors * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 * of the License, or (at your option) any later version. * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Jalview. If not, see . * The Jalview Authors are detailed in the 'AUTHORS' file. */ package jalview.urls; /** * UrlLink table row definition * * @author $author$ * @version $Revision$ */ public class UrlLinkDisplay { private String id; // id is not supplied to display, but used to identify // entries when saved private String name; private String url; private boolean isDefault; private boolean isSelected; public final static int ID = 4; public final static int URL = 1; public final static int SELECTED = 2; public final static int DEFAULT = 3; public final static int NAME = 0; public UrlLinkDisplay(String rowId, String rowName, String rowUrl, boolean rowSelected, boolean rowDefault) { id = rowId; name = rowName; url = rowUrl; isDefault = rowDefault; isSelected = rowSelected; } public String getId() { return id; } public String getName() { return name; } public String getUrl() { return url; } public boolean getIsDefault() { return isDefault; } public boolean getIsSelected() { return isSelected; } public void setUrl(String rowUrl) { url = rowUrl; } public void setIsDefault(boolean rowDefault) { isDefault = rowDefault; } public void setIsSelected(boolean rowSelected) { isSelected = rowSelected; } public Object getValue(int index) { switch (index) { case ID: return id; case URL: return url; case DEFAULT: return isDefault; case SELECTED: return isSelected; case NAME: return name; default: return null; // TODO } } public void setValue(int index, Object value) { switch (index) { case ID: id = (String) value; break; case URL: url = (String) value; break; case DEFAULT: isDefault = (boolean) value; break; case SELECTED: isSelected = (boolean) value; break; case NAME: name = (String) value; break; default: // TODO } } public boolean isEditable(int index) { return ((index == DEFAULT) || (index == SELECTED)); } }