X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FDasSourceBrowser.java;h=faf47122677230eca04c79d6616da79df3f9f72c;hb=1d4bc65204bdb63740d3692f13633c463d5c08fd;hp=e695d3d44d5524869019cd130130a62cdd14e1dc;hpb=dbbd8851fe0e30aa9606657b5f4eb41e0db21563;p=jalview.git
diff --git a/src/jalview/gui/DasSourceBrowser.java b/src/jalview/gui/DasSourceBrowser.java
index e695d3d..faf4712 100755
--- a/src/jalview/gui/DasSourceBrowser.java
+++ b/src/jalview/gui/DasSourceBrowser.java
@@ -1,24 +1,25 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
- * This program 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 2
- * of the License, or (at your option) any later version.
- *
- * This program 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 this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ *
+ * 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 .
*/
package jalview.gui;
+import java.text.ParseException;
import java.util.*;
+import java.util.List;
import java.awt.*;
import java.awt.event.*;
@@ -26,37 +27,55 @@ import javax.swing.*;
import javax.swing.event.*;
import javax.swing.table.*;
-import org.biojava.dasobert.dasregistry.*;
+import org.biodas.jdas.dassources.Capabilities;
+import org.biodas.jdas.dassources.utils.DasCoordinateSystemCollector;
+import org.biodas.jdas.dassources.utils.DasTimeFormat;
+import org.biodas.jdas.schema.registrycoordinates.DASCOORDINATESYSTEM;
+import org.biodas.jdas.schema.sources.CAPABILITY;
+import org.biodas.jdas.schema.sources.COORDINATES;
+import org.biodas.jdas.schema.sources.MAINTAINER;
+import org.biodas.jdas.schema.sources.PROP;
+import org.biodas.jdas.schema.sources.SOURCE;
+import org.biodas.jdas.schema.sources.SOURCES;
+import org.biodas.jdas.schema.sources.VERSION;
+
import jalview.jbgui.*;
import jalview.util.*;
-public class DasSourceBrowser
- extends GDasSourceBrowser implements Runnable, ListSelectionListener
+public class DasSourceBrowser extends GDasSourceBrowser implements
+ Runnable, ListSelectionListener
{
- static DasSource[] dasSources = null;
+ static org.biodas.jdas.schema.sources.SOURCE[] dasSources = null;
- Hashtable localSources = null;
+ Hashtable localSources = null;
Vector selectedSources;
- public static String DEFAULT_REGISTRY =
- "http://www.dasregistry.org/das1/sources/";
+ public static String DEFAULT_REGISTRY = "http://www.dasregistry.org/das1/sources/";
/**
* true if thread is running and we are talking to DAS registry service
*/
public boolean loadingDasSources = false;
- public DasSourceBrowser()
+ protected static String getDasRegistryURL()
{
String registry = jalview.bin.Cache.getDefault("DAS_REGISTRY_URL",
- DEFAULT_REGISTRY);
+ DEFAULT_REGISTRY);
if (registry.indexOf("/registry/das1/sources/") > -1)
{
- jalview.bin.Cache.setProperty("DAS_REGISTRY_URL", DEFAULT_REGISTRY);
+ jalview.bin.Cache.setProperty(jalview.bin.Cache.DAS_REGISTRY_URL,
+ DEFAULT_REGISTRY);
registry = DEFAULT_REGISTRY;
}
+ return registry;
+ }
+
+ public DasSourceBrowser(FeatureSettings featureSettings)
+ {
+ fs = featureSettings;
+ String registry = getDasRegistryURL();
registryURL.setText(registry);
@@ -69,7 +88,7 @@ public class DasSourceBrowser
filter2.addListSelectionListener(this);
filter3.addListSelectionListener(this);
- //Ask to be notified of selection changes.
+ // Ask to be notified of selection changes.
ListSelectionModel rowSM = table.getSelectionModel();
rowSM.addListSelectionListener(new ListSelectionListener()
{
@@ -89,7 +108,7 @@ public class DasSourceBrowser
public void mouseClicked(MouseEvent evt)
{
if (evt.getClickCount() == 2
- || SwingUtilities.isRightMouseButton(evt))
+ || SwingUtilities.isRightMouseButton(evt))
{
editRemoveLocalSource(evt);
}
@@ -102,6 +121,13 @@ public class DasSourceBrowser
}
}
+ FeatureSettings fs = null;
+
+ public DasSourceBrowser()
+ {
+ this(null);
+ }
+
public void paintComponent(java.awt.Graphics g)
{
if (dasSources == null && !loadingDasSources)
@@ -117,9 +143,9 @@ public class DasSourceBrowser
Object[][] data = new Object[dSize][2];
for (int i = 0; i < dSize; i++)
{
- data[i][0] = dasSources[i].getNickname();
- data[i][1] = new Boolean(selectedSources.contains(dasSources[i].
- getNickname()));
+ data[i][0] = dasSources[i].getTitle(); // what's equivalent of nickname
+ data[i][1] = new Boolean(selectedSources.contains(dasSources[i]
+ .getTitle()));
}
refreshTableData(data);
@@ -152,61 +178,65 @@ public class DasSourceBrowser
{
StringBuffer text = new StringBuffer(
- "");
+ "");
if (nickName == null)
{
- fullDetails.setText(text +
- "Select a DAS service from the table"
- + " to read a full description here.");
+ fullDetails.setText(text + "Select a DAS service from the table"
+ + " to read a full description here.");
return;
}
int dSize = dasSources.length;
for (int i = 0; i < dSize; i++)
{
- if (!dasSources[i].getNickname().equals(nickName))
+ if (!dasSources[i].getTitle().equals(nickName))
{
continue;
}
- DasSource ds = dasSources[i];
-
- text.append("Id: " + dasSources[i].getId() +
- "
");
- text.append("Nickname: " +
- dasSources[i].getNickname() + "
");
- text.append("URL: " + dasSources[i].getUrl() +
- "
");
+ SOURCE ds = dasSources[i];
+ VERSION latest = getVersionFor(ds);
+ text.append("Id: "
+ + dasSources[i].getUri() + "
");
+ text.append("Nickname: "
+ + dasSources[i].getTitle() + "
");
+ text.append("URL: " + latest.getUri()
+ + "
");
- text.append(
- "Admin Email: " + dasSources[i].getAdminemail() + "" +
- "
");
+ text.append("Admin Email: "
+ + ds.getMAINTAINER().getEmail() + "" + "
");
- text.append("Registered at: " +
- dasSources[i].getRegisterDate() +
- "
");
+ text.append("Registered at: "
+ + latest.getCreated() + "
");
- text.append("Last successful test: " +
- dasSources[i].getLeaseDate() +
- "
");
+ // TODO: Identify last successful test date
+ // text.append("Last successful test: "
+ // + latest.dasSources[i].getLeaseDate() + "
");
text.append("Labels: ");
- for (int s = 0; s < dasSources[i].getLabels().length; s++)
+ boolean b = false;
+ for (PROP labl : latest.getPROP())
{
- text.append(dasSources[i].getLabels()[s]);
- if (s < dasSources[i].getLabels().length - 1)
+ if (labl.getName().equalsIgnoreCase("LABEL"))
{
- text.append(",");
+ if (!b)
+ {
+ text.append(",");
+ }
+ text.append(" ");
+
+ text.append(labl.getValue());
+ b = true;
}
- text.append(" ");
+ ;
}
text.append("
");
text.append("Capabilities: ");
- String[] scap = dasSources[i].getCapabilities();
+ CAPABILITY[] scap = latest.getCAPABILITY().toArray(new CAPABILITY[0]);
for (int j = 0; j < scap.length; j++)
{
text.append(scap[j]);
@@ -218,39 +248,40 @@ public class DasSourceBrowser
text.append("
");
text.append("Coordinates: ");
- DasCoordinateSystem[] dcs = ds.getCoordinateSystem();
- for (int j = 0; j < dcs.length; j++)
+ for (COORDINATES dcs : latest.getCOORDINATES())
{
- text.append("(" + dcs[j].getUniqueId() + ") "
- + dcs[j].getCategory() + ", " + dcs[j].getName());
- if (dcs[j].getNCBITaxId() != 0)
+ text.append("(" + dcs.getUri() + ") "
+
+ + dcs.getSource() + ", " + dcs.getAuthority());
+ if (dcs.getTaxid() != null && dcs.getTaxid().trim().length() > 0)
{
- text.append(", " + dcs[j].getNCBITaxId());
+ text.append(", " + dcs.getTaxid());
}
- if (dcs[j].getOrganismName().length() > 0)
+ if (dcs.getVersion().trim().length() > 0)
{
- text.append(", " + dcs[j].getOrganismName());
- }
+ {
+ text.append(", " + dcs.getVersion());
+ }
- text.append("
");
- }
+ text.append("
");
+ }
- text.append("Description: " +
- dasSources[i].getDescription() + "
");
+ text.append("Description: "
+ + dasSources[i].getDescription() + "
");
- if (dasSources[i].getHelperurl() != null
- && dasSources[i].getHelperurl().length() > 0)
- {
- text.append("Go to site");
- }
+ if (dasSources[i].getDocHref() != null
+ && dasSources[i].getDocHref().length() > 0)
+ {
+ text.append("Go to site");
+ }
- text.append("