package jalview.urls;
+import jalview.util.MessageManager;
+
+import java.util.ArrayList;
+import java.util.List;
/**
* UrlLink table row definition
private boolean isSelected;
- public final static int ID = 4;
+ // Headers for columns in table
+ private final static List<String> colNames = new ArrayList<String>()
+ {
+ {
+ add(MessageManager.formatMessage("label.name"));
+ add(MessageManager.formatMessage("label.url"));
+ add(MessageManager.formatMessage("label.inmenu"));
+ add(MessageManager.formatMessage("label.default"));
+ add(MessageManager.formatMessage("label.id"));
+ }
+ };
+
+ // column positions
+ public final static int NAME = 0;
public final static int URL = 1;
public final static int DEFAULT = 3;
- public final static int NAME = 0;
+ public final static int ID = 4;
public UrlLinkDisplay(String rowId, String rowName, String rowUrl,
boolean rowSelected, boolean rowDefault)
isSelected = rowSelected;
}
+ // getters/setters
public String getId()
{
return id;
case NAME:
return name;
default:
- return null; // TODO
+ return null;
}
}
name = (String) value;
break;
default:
- // TODO
+ // do nothing
}
}
+ /**
+ * Identify editable columns
+ *
+ * @param index
+ * index of column
+ * @return whether column can be edited in table
+ */
public boolean isEditable(int index)
{
return ((index == DEFAULT) || (index == SELECTED));
}
+
+ /**
+ * Get list of column names to display in UI
+ *
+ * @return column names
+ */
+ public static List<String> getDisplayColumnNames()
+ {
+ // Display names between NAME and ID (excludes ID)
+ return colNames.subList(NAME, ID);
+ }
}