label.view_flanking_regions = Show sequence data either side of the subsequences involved in this alignment
label.structures_manager = Structures Manager
label.nickname = Nickname:
-label.url = URL:
+label.url = URL
+label.url\: = URL:
label.input_file_url = Enter URL or Input File
label.select_feature = Select feature
label.name = Name
action.customfilter = Custom only
label.insert = Insert:
action.seq_id = $SEQUENCE_ID$
-action.db_acc = $DB_ACCESSION$
\ No newline at end of file
+action.db_acc = $DB_ACCESSION$
+label.default = Default
+label.inmenu = In Menu
+label.id = ID
\ No newline at end of file
label.view_flanking_regions = Mostrar los datos de la secuencia a ambos lados de las subsecuencias implicadas en este alineamiento
label.structures_manager = Administrar estructuras
label.nickname = Sobrenombre:
-label.url = URL:
+label.url\: = URL:
+label.url = URL
label.input_file_url = Introducir URL en el fichero de entrada
label.select_feature = Seleccionar característica
label.name = Nombre
label.insert = Insert:
action.seq_id = $SEQUENCE_ID$
action.db_acc = $DB_ACCESSION$
+label.default = Default
+label.inmenu = In Menu
+label.id = ID
\ No newline at end of file
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
-import jalview.urls.UrlProvider;
+import jalview.urls.AppletUrlProviderFactory;
+import jalview.urls.UrlProviderFactoryI;
import jalview.urls.UrlProviderI;
import jalview.viewmodel.AlignmentViewport;
{
// set default as first entry in list
String defaultUrl = av.applet.getParameter("linkLabel_1");
- urlProvider = new UrlProvider(defaultUrl, urlList);
+ UrlProviderFactoryI factory = new AppletUrlProviderFactory(
+ defaultUrl, urlList);
+ urlProvider = factory.createUrlProvider();
}
}
}
pane12.add(nametf, BorderLayout.EAST);
panel.add(pane12, BorderLayout.NORTH);
pane12 = new JPanel(new BorderLayout());
- pane12.add(new JLabel(MessageManager.getString("label.url")),
+ pane12.add(new JLabel(MessageManager.getString("label.url:")),
BorderLayout.NORTH);
pane12.add(seqs, BorderLayout.SOUTH);
pane12.add(urltf, BorderLayout.EAST);
import jalview.jbgui.GPreferences;
import jalview.jbgui.GSequenceLink;
import jalview.schemes.ColourSchemeProperty;
+import jalview.urls.DesktopUrlProviderFactory;
import jalview.urls.UrlLinkTableModel;
-import jalview.urls.UrlProvider;
+import jalview.urls.UrlProviderFactoryI;
import jalview.urls.UrlProviderI;
import jalview.util.MessageManager;
import jalview.util.Platform;
{
String string = Cache.getDefault("SEQUENCE_LINKS",
UrlConstants.DEFAULT_STRING);
- sequenceUrlLinks = new UrlProvider(UrlConstants.DEFAULT_LABEL, string);
+ UrlProviderFactoryI factory = new DesktopUrlProviderFactory(
+ UrlConstants.DEFAULT_LABEL, string);
+ sequenceUrlLinks = factory.createUrlProvider();
dataModel = new UrlLinkTableModel(sequenceUrlLinks);
/**
JTextField urltf = new JTextField(url, 40);
JPanel panel = new JPanel(new BorderLayout());
JPanel pane12 = new JPanel(new BorderLayout());
- pane12.add(new JLabel(MessageManager.getString("label.url")),
+ pane12.add(new JLabel(MessageManager.getString("label.url:")),
BorderLayout.CENTER);
pane12.add(urltf, BorderLayout.EAST);
panel.add(pane12, BorderLayout.NORTH);
new Thread(new Runnable()
{
+ @Override
public void run()
{
// force a refresh.
new Thread(new Runnable()
{
+ @Override
public void run()
{
progressBar.setVisible(true);
new Thread(new Runnable()
{
+ @Override
public void run()
{
long ct = System.currentTimeMillis();
new Thread(new Runnable()
{
+ @Override
public void run()
{
updateWsMenuConfig(false);
jLabel1.setBounds(new Rectangle(4, 10, 71, 24));
jLabel2.setFont(JvSwingUtils.getLabelFont());
jLabel2.setHorizontalAlignment(SwingConstants.TRAILING);
- jLabel2.setText(MessageManager.getString("label.url"));
+ jLabel2.setText(MessageManager.getString("label.url:"));
jLabel2.setBounds(new Rectangle(17, 37, 54, 27));
jLabel3.setFont(new java.awt.Font("Verdana", Font.ITALIC, 11));
jLabel3.setText(MessageManager.getString("label.use_sequence_id_1"));
--- /dev/null
+/*
+ * 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 <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.urls;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * UrlProvider factory for applet code
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+
+public class AppletUrlProviderFactory implements UrlProviderFactoryI
+{
+ private String provDefaultUrl;
+
+ private Map<String, String> provUrlList;
+
+ public AppletUrlProviderFactory(String defaultUrlString,
+ Map<String, String> urlList)
+ {
+ provDefaultUrl = defaultUrlString;
+ provUrlList = urlList;
+ }
+
+ @Override
+ public UrlProviderI createUrlProvider()
+ {
+ // create all the UrlProviders we need
+ List<UrlProviderI> providers = new ArrayList<UrlProviderI>();
+ UrlProviderI customProvider = new CustomUrlProvider(provUrlList);
+ providers.add(customProvider);
+
+ UrlProviderI prov = new UrlProvider(provDefaultUrl, providers);
+ return null;
+ }
+
+}
// out
// properly!
displayLinks.add(new UrlLinkDisplay(key, key, displayLink,
- isSelected,
- isDefault));
+ isSelected, isDefault));
}
return displayLinks;
}
--- /dev/null
+/*
+ * 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 <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.urls;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * UrlProvider factory for desktop code
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+
+public class DesktopUrlProviderFactory implements UrlProviderFactoryI
+{
+
+ private String provDefaultUrl;
+
+ private String provUrlList;
+
+ public DesktopUrlProviderFactory(String defaultUrlString,
+ String cachedUrlList)
+ {
+ provDefaultUrl = defaultUrlString;
+ provUrlList = cachedUrlList;
+ }
+
+ @Override
+ public UrlProviderI createUrlProvider()
+ {
+ // create all the UrlProviders we need
+ List<UrlProviderI> providers = new ArrayList<UrlProviderI>();
+
+ UrlProviderI idProvider = new IdentifiersUrlProvider(provUrlList,
+ IdentifiersUrlProvider.ID_ORG_FILE);
+ UrlProviderI customProvider = new CustomUrlProvider(provUrlList);
+ providers.add(idProvider);
+ providers.add(customProvider);
+
+ return new UrlProvider(provDefaultUrl, providers);
+ }
+
+}
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);
+ }
}
{
dataProvider = baseData;
data = baseData.getLinksForTable();
- displayColumns = baseData.getDisplayColumnNames();
+ displayColumns = UrlLinkDisplay.getDisplayColumnNames();
// find the default row
defaultRow = 0;
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
import java.util.Vector;
/**
// Specific reference to custom URL link provider
private UrlProviderI customProvider;
- // List of columns which this provider will supply
- private List<String> colNames = new ArrayList<String>();
-
/**
- * Construct URL provider from string of cached URLs, and set default URL
+ * Constructor for UrlProvider composite
*
* @param defaultUrlString
- * id of the current default URL
- * @param cachedUrlList
- * string listing current active URLs, expected to be custom URLs
- * separated by |, or ids of URLs
+ * id of default url
+ * @param allProviders
+ * list of UrlProviders this provider gives access to
*/
- public UrlProvider(String defaultUrlString, String cachedUrlList)
+ public UrlProvider(String defaultUrlString,
+ List<UrlProviderI> allProviders)
{
- // create all the UrlProviders we need
- providers = new ArrayList<UrlProviderI>();
-
- UrlProviderI idProvider = new IdentifiersUrlProvider(cachedUrlList,
- IdentifiersUrlProvider.ID_ORG_FILE);
- customProvider = new CustomUrlProvider(cachedUrlList);
- providers.add(idProvider);
- providers.add(customProvider);
+ providers = allProviders;
- setUpColumns();
+ customProvider = findCustomProvider();
// check that the defaultUrl still exists
if (!setDefaultUrl(defaultUrlString))
chooseDefaultUrl();
}
}
-
- /**
- * Construct URL provider from a map of (label,url) pairs, and set default URL
- *
- * @param defaultUrlString
- * id of the current default URL
- * @param urlList
- * vector of (label, url) pairs
+
+ /*
+ * Store ref to custom url provider
*/
- public UrlProvider(String defaultUrlString, Map<String, String> urlList)
+ private UrlProviderI findCustomProvider()
{
- // create all the UrlProviders we need
- providers = new ArrayList<UrlProviderI>();
-
- UrlProviderI idProvider = new IdentifiersUrlProvider(null,
- IdentifiersUrlProvider.ID_ORG_FILE);
- customProvider = new CustomUrlProvider(urlList);
- providers.add(idProvider);
- providers.add(customProvider);
-
- setUpColumns();
-
- // check that the defaultUrl still exists
- if (!setDefaultUrl(defaultUrlString))
+ for (UrlProviderI p : providers)
{
- chooseDefaultUrl();
+ if (p.getClass().equals(CustomUrlProvider.class))
+ {
+ return p;
+ }
}
- }
- private void setUpColumns()
- {
- colNames.add("Name");
- colNames.add("URL");
- colNames.add("In Menu");
- colNames.add("Default");
- colNames.add("ID");
+ System.out
+ .println("Error initialising UrlProvider - no custom url provider");
+ return null;
}
@Override
{
return customProvider.isUserEntry(id);
}
-
- @Override
- public List<String> getDisplayColumnNames()
- {
- return colNames.subList(0, 4);
- }
}
--- /dev/null
+/*
+ * 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 <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.urls;
+
+/**
+ * Interface to UrlProvider factories
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public interface UrlProviderFactoryI
+{
+ public UrlProviderI createUrlProvider();
+
+}
* Determine if id is for a user-defined URL
*/
boolean isUserEntry(String id);
-
- /**
- * Get list of column names to display in UI
- *
- * @return column names
- */
- List<String> getDisplayColumnNames();
}
return !isMiriamId(id);
}
- @Override
- public List<String> getDisplayColumnNames()
- {
- return null;
- }
-
}