import jalview.bin.Cache;
import jalview.jbgui.GWsPreferences;
+import jalview.ws.rest.RestServiceDescription;
public class WsPreferences extends GWsPreferences
{
initFromPreferences();
}
- Vector<String> wsUrls, oldUrls;
+ Vector<String> wsUrls, oldUrls,rsbsUrls,oldRsbsUrls;
private boolean needWsMenuUpdate;
wsUrls = new Vector<String>();
}
updateList();
+ rsbsUrls = jalview.ws.rest.RestClient.getRsbsDescriptions();
+ if (rsbsUrls != null)
+ {
+ oldRsbsUrls = new Vector<String>(rsbsUrls);
+ }
+ else
+ {
+ oldRsbsUrls = null;
+ rsbsUrls = new Vector<String>();
+ }
+ updateRsbsList();
enableEnfinServices.setSelected(oldEnfin = Cache.getDefault(
"SHOW_ENFIN_SERVICES", true));
enableEnfinServices.addActionListener(updateAction);
wsList.setListData(wsUrls);
}
+ private void updateRsbsList()
+ {
+ sbrsList.setListData(rsbsUrls);
+ }
+
private void updateServiceList()
{
jalview.ws.jws2.Jws2Discoverer.setServiceUrls(wsUrls);
}
+ private void updateRsbsServiceList()
+ {
+ jalview.ws.rest.RestClient.setRsbsServices(rsbsUrls);
+ }
+
/*
* (non-Javadoc)
*
int sel = wsList.getSelectedIndex();
if (sel > -1)
{
- String url = editUrl(wsUrls.elementAt(sel), "Edit JWS2 URL");
+ String url = editUrl(wsUrls.elementAt(sel), "Edit JABAWS URL");
if (url != null)
{
int present = wsUrls.indexOf(url);
}
}
}
-
+ @Override
+ protected void newSbrsUrl_actionPerformed(ActionEvent e)
+ {
+ RestServiceEditorPane rse = new RestServiceEditorPane();
+ rse.showDialog("Add a new Simple Bioinformatics Rest Service");
+ String rservice = rse.getEditedRestService();
+ if (rservice!=null && !rsbsUrls.contains(rservice))
+ {
+ rsbsUrls.add(rservice);
+ update++;
+ updateRsbsList();
+ }
+ }
+ @Override
+ protected void editSbrsUrl_actionPerformed(ActionEvent e)
+ {
+ int sel = sbrsList.getSelectedIndex();
+ if (sel > -1)
+ {
+ RestServiceEditorPane rse = new RestServiceEditorPane(new RestServiceDescription(rsbsUrls.elementAt(sel)));
+ rse.showDialog("Edit Simple Bioinformatics Rest Service entry");
+ String rservice = rse.getEditedRestService();
+ if (rservice!=null)
+ {
+ int present = rsbsUrls.indexOf(rservice);
+ if (present==-1) {
+ update++;
+ rsbsUrls.setElementAt(rservice,sel);
+ updateRsbsList();
+ } else {
+ if (present!=sel) {
+ rsbsUrls.removeElementAt(sel);
+ update++;
+ updateRsbsList();
+ }
+ }
+ }
+ }
+ }
+
void updateWsMenuConfig(boolean old)
{
if (old)
update++;
}
wsUrls = (oldUrls == null) ? null : new Vector(oldUrls);
+ if (oldRsbsUrls!=rsbsUrls || (rsbsUrls!=null && oldRsbsUrls!=null && !oldRsbsUrls.equals(rsbsUrls)))
+ {
+ update++;
+ }
+ oldRsbsUrls = (oldRsbsUrls == null) ? null : new Vector(oldRsbsUrls);
}
else
{
"WSMENU_BYTYPE",
Boolean.valueOf(old ? oldIndexByType : indexByType.isSelected())
.toString());
+
Cache.setProperty("SHOW_WSDISCOVERY_ERRORS",
Boolean.valueOf(old ? oldWsWarning : displayWsWarning.isSelected()).toString());
updateServiceList();
+ updateRsbsServiceList();
}
/*
wsUrls.setElementAt(t, p);
updateList();
wsList.setSelectedIndex(p + 1);
+ update++;
}
}
wsUrls.setElementAt(t, p);
updateList();
wsList.setSelectedIndex(p - 1);
+ update++;
}
}
@Override
protected void newWsUrl_actionPerformed(ActionEvent e)
{
- String url = editUrl(null, "Add new JWS2 URL");
+ String url = editUrl(null, "Add new JABAWS URL");
if (url != null)
{
if (!wsUrls.contains(url))