## public interface JalviewJSApi
-# full list of available methods:
+# full list of available methods (from JalviewLiteJsApi):
public boolean addPdbFile(AlignFrame alFrame, String sequenceId, String pdbEntryString, String pdbFile);
- public String arrayToSeparatorList(String[] array);
public String getAlignment(String format);
public String getAlignment(String format, String suffix);
public String getAlignmentFrom(AlignFrame alf, String format);
public void select(String sequenceIds, String columns, String sep);
public void selectIn(AlignFrame alf, String sequenceIds, String columns);
public void selectIn(AlignFrame alf, String sequenceIds, String columns, String sep);
- public String[] separatorListToArray(String list);
public void setFeatureGroupState(String groups, boolean state);
public void setFeatureGroupState(String[] groups, boolean state);
public void setFeatureGroupStateOn(AlignFrame alf, String groups, boolean state);
public void showOverview();
public void updateForAnnotations();
+# addition available methods (from JalviewLite):
+
+ public static String getBuildDate()
+ public static String getInstallation()
+ public static String getVersion()
+
+
+
# proposed alias list:
- remove overloaded methods
# unknown methods/shouldn't be in interface?
- public String arrayToSeparatorList(String[] array);
public Object getFrameForSource(VamsasSource source);
- public String getSeparator();
- public String[] separatorListToArray(String list);
public void setSeparator(String separator);
\ No newline at end of file
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
-import java.util.Hashtable;
import java.util.List;
import java.util.StringTokenizer;
import java.util.Vector;
import jalview.datamodel.SequenceI;
import jalview.gui.AlignFrame;
import jalview.gui.AlignViewport;
-import jalview.gui.AlignmentPanel;
import jalview.gui.CalculationChooser;
import jalview.gui.Desktop;
import jalview.gui.StructureViewer;
import jalview.io.JPredFile;
import jalview.io.JnetAnnotationMaker;
import jalview.io.NewickFile;
-import jalview.renderer.seqfeatures.FeatureRenderer;
import jalview.structure.SelectionListener;
import jalview.structure.SelectionSource;
import jalview.structure.StructureSelectionManager;
}
@Override
- public FeatureRenderer getNewFeatureRenderer(AlignViewportI vp)
- {
- return new jalview.gui.FeatureRenderer((AlignmentPanel) vp);
- }
-
- @Override
public Object[] getSelectionForListener(SequenceGroup seqsel,
ColumnSelection colsel, HiddenColumns hidden,
SelectionSource source, Object alignFrame)
}
+ /**
+ * @j2sAlias showStructure
+ */
+ @Override
+ public void showStructure(AlignFrame af, String pdbID, String fileType) {
+ if (af == null)
+ af = Jalview.getCurrentAlignFrame();
+ PDBEntry pe = null;
+ SequenceI[] seqs = null;
+ if (pdbID == null) {
+ seqs = af.getViewport().getSequenceSelection();
+ if (seqs.length == 0)
+ seqs = af.getViewport().getAlignment().getSequencesArray();
+ for (int i = 0; i < seqs.length; i++) {
+ Vector<PDBEntry> list = seqs[i].getAllPDBEntries();
+ if (list.size() > 0) {
+ pe = list.get(0);
+ break;
+ }
+ }
+ }
+ if (pe == null) {
+ if (pdbID == null)
+ return;
+ pe = new PDBEntry(pdbID, null, fileType);
+ List<SequenceI> list = af.getViewport().getAlignment().getSequences();
+ List<SequenceI> tmp = new ArrayList<SequenceI>();
+ for (int i = 0; i < list.size(); i++) {
+ SequenceI seq = list.get(i);
+ if (seq.getPDBEntry(pdbID) != null) {
+ tmp.add(seq);
+ }
+ }
+ seqs = tmp.toArray(new SequenceI[tmp.size()]);
+ af.alignPanel.selectSequences(tmp);
+ }
+ StructureViewer.launchStructureViewer(
+ af.alignPanel,
+ pe, seqs);
+ }
+
public void newStructureView(AlignFrame af, PDBEntry pdb,
SequenceI[] seqs, String[] chains, DataSourceType protocol)
{
}
@Override
- public boolean addPdbFile(AlignFrame alf, String sequenceId,
- String pdbEntryString, String pdbFile)
+ public boolean addPdbFile(AlignFrame alf, String sequenceId, String pdbId,
+ String pdbFile)
{
if (alf == null)
{
alf = Jalview.getCurrentAlignFrame();
}
- SequenceI toaddpdb = alf.getViewport().getAlignment()
- .findName(sequenceId);
- boolean needtoadd = false;
- if (toaddpdb != null)
+ SequenceI seq = alf.getViewport().getAlignment().findName(sequenceId);
+ if (seq != null)
{
- Vector<PDBEntry> pdbe = toaddpdb.getAllPDBEntries();
+ Vector<PDBEntry> pdbe = seq.getAllPDBEntries();
PDBEntry pdbentry = null;
if (pdbe != null && pdbe.size() > 0)
{
for (int pe = 0, peSize = pdbe.size(); pe < peSize; pe++)
{
pdbentry = pdbe.elementAt(pe);
- if (!pdbentry.getId().equals(pdbEntryString)
- && !pdbentry.getFile().equals(pdbFile))
+ if (!pdbentry.getId().equals(pdbId)
+ || pdbFile != null && !pdbentry.getFile().equals(pdbFile))
{
pdbentry = null;
}
- else
- {
- continue;
- }
}
}
if (pdbentry == null)
{
- pdbentry = new PDBEntry();
- pdbentry.setId(pdbEntryString);
- pdbentry.setFile(pdbFile);
- needtoadd = true; // add this new entry to sequence.
- }
- // resolve data source
- // TODO: this code should be a refactored to an io package
- DataSourceType protocol = AppletFormatAdapter.resolveProtocol(pdbFile,
- FileFormat.PDB);
- if (protocol == null)
- {
- return false;
- }
- if (needtoadd)
- {
- pdbentry.setProperty("protocol", protocol);
- toaddpdb.addPDBId(pdbentry);
+ pdbentry = new PDBEntry(pdbId, null, pdbFile);
+ if (pdbFile != null)
+ {
+ DataSourceType protocol = AppletFormatAdapter
+ .resolveProtocol(pdbFile, FileFormat.PDB);
+ if (protocol == null)
+ return false;
+ pdbentry.setProperty("protocol", protocol);
+ }
+ seq.addPDBId(pdbentry);
alf.alignPanel.getStructureSelectionManager()
.registerPDBEntry(pdbentry);
}
return true;
}
- @Override
- public String arrayToSeparatorList(String[] array)
- {
- return arrayToSeparatorList(array, separator);
- }
-
- /**
- * concatenate the list with separator
- *
- * @param list
- * @param separator
- * @return concatenated string
- */
- public static String arrayToSeparatorList(String[] list, String separator)
- {
- // TODO use StringUtils version
- StringBuffer v = new StringBuffer();
- if (list != null && list.length > 0)
- {
- for (int i = 0, iSize = list.length; i < iSize; i++)
- {
- if (list[i] != null)
- {
- if (i > 0)
- {
- v.append(separator);
- }
- v.append(list[i]);
- }
- }
- // if (debug)
- // {
- // System.err
- // .println("Returning '" + separator + "' separated List:\n");
- // System.err.println(v);
- // }
- return v.toString();
- }
- // if (debug)
- // {
- // System.err.println(
- // "Returning empty '" + separator + "' separated List\n");
- // }
- return "" + separator;
- }
+// @Override
+// public String arrayToSeparatorList(String[] array)
+// {
+// return arrayToSeparatorList(array, separator);
+// }
+
+// /**
+// * concatenate the list with separator
+// *
+// * @param list
+// * @param separator
+// * @return concatenated string
+// */
+// public static String arrayToSeparatorList(String[] list, String separator)
+// {
+// // TODO use StringUtils version
+// StringBuffer v = new StringBuffer();
+// if (list != null && list.length > 0)
+// {
+// for (int i = 0, iSize = list.length; i < iSize; i++)
+// {
+// if (list[i] != null)
+// {
+// if (i > 0)
+// {
+// v.append(separator);
+// }
+// v.append(list[i]);
+// }
+// }
+// // if (debug)
+// // {
+// // System.err
+// // .println("Returning '" + separator + "' separated List:\n");
+// // System.err.println(v);
+// // }
+// return v.toString();
+// }
+// // if (debug)
+// // {
+// // System.err.println(
+// // "Returning empty '" + separator + "' separated List\n");
+// // }
+// return "" + separator;
+// }
@Override
public String getAlignment(String format)
}
@Override
- public String getAlignmentOrderFrom(AlignFrame alf)
- {
- return getAlignmentFrom(alf, null);
- }
-
- @Override
- public String getAlignmentOrderFrom(AlignFrame alf, String sep)
+ public String[] getAlignmentOrderFrom(AlignFrame alf)
{
if (alf == null)
{
{
order[i] = alorder.getSequenceAt(i).getName();
}
- return arrayToSeparatorList(order, sep);
+ return order;// arrayToSeparatorList(order, sep);
}
@Override
}
@Override
- public String getFeatureGroups()
+ public String[] getFeatureGroups()
{
return getFeatureGroupsOn(null);
}
@Override
- public String getFeatureGroupsOfState(boolean visible)
+ public String[] getFeatureGroupsOfState(boolean visible)
{
return getFeatureGroupsOfStateOn(null, visible);
}
@Override
- public String getFeatureGroupsOfStateOn(AlignFrame alf, boolean visible)
+ public String[] getFeatureGroupsOfStateOn(AlignFrame alf, boolean visible)
{
if (alf == null)
{
alf = Jalview.getCurrentAlignFrame();
}
- return arrayToSeparatorList(alf.getFeatureGroupsOfState(visible));
+ return alf.getFeatureGroupsOfState(visible);
}
@Override
- public String getFeatureGroupsOn(AlignFrame alf)
+ public String[] getFeatureGroupsOn(AlignFrame alf)
{
if (alf == null)
{
alf = Jalview.getCurrentAlignFrame();
}
- return arrayToSeparatorList(alf.getFeatureGroups());
+ return alf.getFeatureGroups();
}
@Override
cols[0] = "" + (1 + strt) + "-" + (1 + end);
}
}
- return new Object[] { src, setid, arrayToSeparatorList(seqs),
- arrayToSeparatorList(cols) };
- }
-
- @Override
- public String getSeparator()
- {
- return separator;
+ return new Object[] { src, setid, seqs, cols };
}
/**
}
/**
+ * @j2sAlias openPcaPanel
+ *
* public static method for JalviewJS API to open a PCAPanel without
* necessarily using a dialog.
*
}
/**
+ * @j2sAlias openTreePanel
+ *
* Open a new Tree panel on the desktop statically. Params are standard (not
* set by Groovy). No dialog is opened.
*
return CalculationChooser.openTreePanel(af, treeType, modelName, null);
}
+
@Override
- public String orderAlignmentBy(AlignFrame alf, String order,
- String undoName, String sep)
+ public String orderBy(String[] ids, String undoName)
{
- if (sep == null || sep.length() == 0)
- {
- sep = separator;
- }
- String[] ids = separatorListToArray(order, sep);
+ return orderAlignmentBy(null, ids, undoName);
+ }
+
+ @Override
+ public String orderAlignmentBy(AlignFrame alf, String[] ids,
+ String undoName)
+ {
+ if (alf == null)
+ alf = Jalview.getCurrentAlignFrame();
SequenceI[] sqs = null;
if (ids != null && ids.length > 0)
{
- if (alf == null)
- {
- alf = Jalview.getCurrentAlignFrame();
- }
jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher(
alf.getViewport().getAlignment().getSequencesArray());
int s = 0;
return alf.sortBy(aorder, _undoName) ? "true" : "";
}
- @Override
- public String orderBy(String order, String undoName)
- {
- return orderBy(order, undoName, null);
- }
-
- @Override
- public String orderBy(String order, String undoName, String sep)
- {
- return orderAlignmentBy(Jalview.getCurrentAlignFrame(), order, undoName,
- sep);
- }
-
/**
* Allow an outside entity to initiate the second half of argument parsing
* (only).
}
}
- // public AlignFrame newViewFrom(AlignFrame alf, String name)
- // {
- // return (AlignFrame) alf.newView(name, true);
- // }
- //
- @Override
- public String[] separatorListToArray(String list)
- {
- return separatorListToArray(list, separator);
- }
-
@Override
public void setFeatureGroupState(String[] groups, boolean state)
{
}
@Override
- public void setSeparator(String separator)
- {
- this.separator = separator;
- }
-
- @Override
public void showOverview()
{
Jalview.getCurrentAlignFrame().overviewMenuItem_actionPerformed(null);
if (seqsel != null && seqsel.getSize() > 0)
{
// send a valid range, otherwise we send the empty selection
- cols = new String[2];
+ cols = new String[1];
cols[0] = "" + (1 + strt) + "-" + (1 + end);
}
;
doSendCallback(_listener,
new Object[]
- { src, setid, arrayToSeparatorList(seqs),
- arrayToSeparatorList(cols) });
+ { src, setid, seqs, cols });
}
public boolean isFor(AlignFrame af, String listener)
import java.io.IOException;
import java.net.URL;
-import java.util.Hashtable;
import jalview.api.AlignViewportI;
import jalview.datamodel.ColumnSelection;
* - null or specific AlignFrame. This specifies the dataset that
* will be searched for a seuqence called sequenceId
* @param sequenceId
- * - sequenceId within the dataset.
- * @param pdbEntryString
- * - the short name for the PDB file
+ * - sequenceId within the dataset or null
+ * @param pdbId
+ * - the four-character PDB ID
* @param pdbFile
- * - pdb file - either a URL or a valid PDB file.
- * @return true if binding was as success TODO: consider making an exception
- * structure for indicating when PDB parsing or sequenceId location
- * fails.
+ * - pdb file - either a URL or a valid PDB file or null.
+ * @return true if binding was success
*/
- public boolean addPdbFile(AlignFrame alFrame, String sequenceId, String pdbEntryString, String pdbFile);
-
- public String arrayToSeparatorList(String[] array);
+ public boolean addPdbFile(AlignFrame alFrame, String sequenceId,
+ String pdbId, String pdbFile);
/**
* The following public methods may be called externally, eg via javascript in
* an HTML page.
*
* <br>
- * <em>TODO: introduce interface for
- * jalview.appletgui.AlignFrame</em><br>
+ * <em>TODO: introduce interface for jalview.appletgui.AlignFrame</em><br>
*
* Most function arguments are strings, which contain serialised versions of
* lists. Lists of things are separated by a separator character - either the
* @param suffix
* @return
*/
- public String getAlignmentFrom(AlignFrame alf, String format, String suffix);
+ public String getAlignmentFrom(AlignFrame alf, String format,
+ String suffix);
/**
* get a separator separated list of sequence IDs reflecting the order of the
* @param alf
* @return
*/
- public String getAlignmentOrderFrom(AlignFrame alf);
-
- /**
- * get a sep separated list of sequence IDs reflecting the order of the
- * alignment in alf
- *
- * @param alf
- * @param sep
- * - separator to use
- * @return
- */
- public String getAlignmentOrderFrom(AlignFrame alf, String sep);
+ public String[] getAlignmentOrderFrom(AlignFrame alf);
/**
* get current alignment's annotation as an annotation file
* @see jalview.appletgui.AlignFrame#getFeatureGroups();
*/
- public String getFeatureGroups();
+ public String[] getFeatureGroups();
/**
* @param visible
* @see jalview.appletgui.AlignFrame#getFeatureGroupsOfState(boolean);
*/
- public String getFeatureGroupsOfState(boolean visible);
+ public String[] getFeatureGroupsOfState(boolean visible);
/**
* @param alf
* @return
* @see jalview.appletgui.AlignFrame#getFeatureGroupsOfState(boolean);
*/
- public String getFeatureGroupsOfStateOn(AlignFrame alf, boolean visible);
+ public String[] getFeatureGroupsOfStateOn(AlignFrame alf,
+ boolean visible);
/**
* @param alf
* @return
* @see jalview.appletgui.AlignFrame#getFeatureGroups();
*/
- public String getFeatureGroupsOn(AlignFrame alf);
+ public String[] getFeatureGroupsOn(AlignFrame alf);
/**
* get the sequence features in the given format (Jalview or GFF);
public Object getFrameForSource(VamsasSource source);
- public jalview.renderer.seqfeatures.FeatureRenderer getNewFeatureRenderer(AlignViewportI vp);
-
public String getParameter(String name);
/**
* current selection
*/
- public String getSelectedSequencesAsAlignment(String format, String suffix);
+ public String getSelectedSequencesAsAlignment(String format,
+ String suffix);
/**
* get sequences selected in alf and return their alignment in format 'format'
* @return selected sequences as flat file or empty string if there was no
* current selection
*/
- public String getSelectedSequencesAsAlignmentFrom(AlignFrame alf, String format, String suffix);
+ public String getSelectedSequencesAsAlignmentFrom(AlignFrame alf,
+ String format, String suffix);
/**
* @param alf
*/
public SequenceI[] getSelectedSequencesFrom(AlignFrame alf, String sep);
- public Object[] getSelectionForListener(SequenceGroup seqsel, ColumnSelection colsel, HiddenColumns hidden, SelectionSource source, Object alignFrame);
-
- /**
- * List separator string
- *
- * @return the separator
- */
-
- public String getSeparator();
+ public Object[] getSelectionForListener(SequenceGroup seqsel,
+ ColumnSelection colsel, HiddenColumns hidden,
+ SelectionSource source, Object alignFrame);
public AlignViewportI getViewport();
* column or unaligned sequence position
*/
- public void highlight(String sequenceId, String position, String alignedPosition);
+ public void highlight(String sequenceId, String position,
+ String alignedPosition);
/**
*
* false, blank or something else - indicate if position is an
* alignment column or unaligned sequence position
*/
- public void highlightIn(AlignFrame alf, String sequenceId, String position, String alignedPosition);
+ public void highlightIn(AlignFrame alf, String sequenceId,
+ String position, String alignedPosition);
/**
*
* be parsed from the string.
* @return true if data parsed as features
*/
- public boolean loadFeaturesFrom(AlignFrame alf, String features, boolean autoenabledisplay);
+ public boolean loadFeaturesFrom(AlignFrame alf, String features,
+ boolean autoenabledisplay);
public boolean loadScoreFile(String sScoreFile) throws IOException;
public void newFeatureSettings();
- public void newStructureView(PDBEntry pdb, SequenceI[] seqs, String[] chains, DataSourceType protocol);
-
- /**
- * public static method for JalviewJS API to open a PCAPanel without
- * necessarily using a dialog.
- *
- * @param af
- * may be null
- * @param modelName
- * @return the PCAPanel, or the string "label.you_need_at_least_n_sequences"
- * if number of sequences selected is inappropriate
- */
- public Object openPcaPanel(AlignFrame af, String modelName);
-
- /**
- * Open a new Tree panel on the desktop statically. Params are standard (not
- * set by Groovy). No dialog is opened.
- *
- * @param af
- * may be null
- * @param treeType
- * @param modelName
- * @return null, or the string "label.you_need_at_least_n_sequences" if number
- * of sequences selected is inappropriate
- */
- public Object openTreePanel(AlignFrame af, String treeType, String modelName);
+ public void newStructureView(PDBEntry pdb, SequenceI[] seqs,
+ String[] chains, DataSourceType protocol);
/// in http://www.jalview.org/examples/jalviewLiteJs.html but missing here
// suffix
/**
- * re-order the given alignment using the given list of sequence IDs separated
- * by sep
+ * re-order the given alignment using the given array of sequence IDs
*
* @param alf
- * @param order
- * - sep separated list
+ * @param ids
+ * array of sequence IDs
* @param undoName
* - string to use when referring to ordering action in undo buffer
- * @param sep
* @return 'true' if alignment was actually reordered. empty string if
* alignment did not contain sequences.
*/
- public String orderAlignmentBy(AlignFrame alf, String order, String undoName, String sep);
+ String orderAlignmentBy(AlignFrame alf, String[] ids, String undoName);
// get a string array from a list
/**
* re-order the current alignment using the given list of sequence IDs
*
- * @param order
- * - sep separated list
+ * @param ids
+ * array of sequence IDs
* @param undoName
* - string to use when referring to ordering action in undo buffer
* @return 'true' if alignment was actually reordered. empty string if
* alignment did not contain sequences.
*/
- public String orderBy(String order, String undoName);
+ public String orderBy(String[] ids, String undoName);
/**
* re-order the current alignment using the given list of sequence IDs
- * separated by sep
*
- * @param order
- * - sep separated list
+ * @param ids
+ * array of sequence IDs
* @param undoName
* - string to use when referring to ordering action in undo buffer
* @param sep
* alignment did not contain sequences.
*/
- public String orderBy(String order, String undoName, String sep);
-
- /**
- * process commandline arguments after the JavaScript application has started
- *
- * @param args
- * @return
- */
- public Object parseArguments(String[] args);
+ // public String orderBy(String[] ids, String undoName, String sep);
+ //
// public boolean getDefaultParameter(String name, boolean def);
* @param topRow
* @param leftHandColumn
*/
- public void scrollViewToIn(AlignFrame alf, String topRow, String leftHandColumn);
+ public void scrollViewToIn(AlignFrame alf, String topRow,
+ String leftHandColumn);
/**
* adjust vertical scroll to make the given row the top one for given view
* @param sep
* separator between toselect fields
*/
- public void selectIn(AlignFrame alf, String sequenceIds, String columns, String sep);
-
- public String[] separatorListToArray(String list);
+ public void selectIn(AlignFrame alf, String sequenceIds, String columns,
+ String sep);
public void setFeatureGroupState(String groups, boolean state);
* @see jalview.appletgui.AlignFrame#setFeatureGroupState(java.lang.String[],
* boolean);
*/
- public void setFeatureGroupStateOn(AlignFrame alf, String groups, boolean state);
+ public void setFeatureGroupStateOn(AlignFrame alf, String groups,
+ boolean state);
public void setSelectionListener(AlignFrame af, String listener);
public void setSelectionListener(String listener);
+ public void updateForAnnotations();
+
+ // Bob's additions:
+
/**
- * List separator string
+ * public static method for JalviewJS API to open a PCAPanel without
+ * necessarily using a dialog.
*
- * @param separator
- * the separator to set. empty string will reset separator to default
+ * @param af
+ * may be null
+ * @param modelName
+ * @return the PCAPanel, or the string "label.you_need_at_least_n_sequences"
+ * if number of sequences selected is inappropriate
*/
+ public Object openPcaPanel(AlignFrame af, String modelName);
- public void setSeparator(String separator);
+ /**
+ * Open a new Tree panel on the desktop statically. Params are standard (not
+ * set by Groovy). No dialog is opened.
+ *
+ * @param af
+ * may be null
+ * @param treeType
+ * @param modelName
+ * @return null, or the string "label.you_need_at_least_n_sequences" if number
+ * of sequences selected is inappropriate
+ */
+ public Object openTreePanel(AlignFrame af, String treeType,
+ String modelName);
- public void showOverview();
+ /**
+ * process commandline arguments after the JavaScript application has started
+ *
+ * @param args
+ * @return
+ */
+ public Object parseArguments(String[] args);
- public void updateForAnnotations();
+ public void showStructure(AlignFrame af, String pdbID, String fileType);
+
+ public void showOverview();
}
@Override
public SequenceI findName(SequenceI startAfter, String token, boolean b)
{
-
+ if (token == null)
+ return null;
int i = 0;
SequenceI sq = null;
String sqname = null;
package jalview.datamodel;
import jalview.util.CaseInsensitiveString;
+import jalview.ws.params.InvalidArgumentException;
import java.util.Collections;
import java.util.Enumeration;
{
}
+ /**
+ * Entry point when file is not known and fileType may be string
+ * @param pdbId
+ * @param chain may be null
+ * @param fileType "pdb", "mmcif", or "bcif"; null defaults to mmcif
+ */
+ public PDBEntry(String pdbId, String chain, String fileType) {
+ this.id = pdbId.toLowerCase();
+ setChainCode(chain); // I note that PDB Chains ARE case-sensitive now
+ if (fileType == null)
+ fileType = "mmcif";
+ switch (fileType.toLowerCase()) {
+ case "pdb":
+ this.type = Type.PDB.toString();
+ break;
+ case "mmcif":
+ this.type = Type.MMCIF.toString();
+ break;
+ default:
+ case "bcif":
+ System.out.println("format " + fileType + " has not been implemented; using mmCIF");
+ this.type = Type.MMCIF.toString();
+ break;
+ }
+ }
+
public PDBEntry(String pdbId, String chain, PDBEntry.Type type,
String filePath)
{
return id;
}
+ /**
+ * TODO
+ *
+ * @param key "protocol"
+ * @param value
+ */
public void setProperty(String key, Object value)
{
if (this.properties == null)
{
case 27: // escape key
- deselectAllSequenceMenuItem_actionPerformed(null);
+ alignPanel.deselectAllSequences();
break;
@Override
public void selectAllSequenceMenuItem_actionPerformed(ActionEvent e)
{
- SequenceGroup sg = new SequenceGroup(
- viewport.getAlignment().getSequences());
-
- sg.setEndRes(viewport.getAlignment().getWidth() - 1);
- viewport.setSelectionGroup(sg);
- viewport.isSelectionGroupChanged(true);
- viewport.sendSelection();
- // JAL-2034 - should delegate to
- // alignPanel to decide if overview needs
- // updating.
- alignPanel.paintAlignment(false, false);
- PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());
+ alignPanel.selectAllSequences();
}
/**
@Override
public void deselectAllSequenceMenuItem_actionPerformed(ActionEvent e)
{
- if (viewport.cursorMode)
- {
- alignPanel.getSeqPanel().keyboardNo1 = null;
- alignPanel.getSeqPanel().keyboardNo2 = null;
- }
- viewport.setSelectionGroup(null);
- viewport.getColumnSelection().clear();
- viewport.setSelectionGroup(null);
- alignPanel.getIdPanel().getIdCanvas().searchResults = null;
- // JAL-2034 - should delegate to
- // alignPanel to decide if overview needs
- // updating.
- alignPanel.paintAlignment(false, false);
- PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());
- viewport.sendSelection();
+ alignPanel.deselectAllSequences();
}
/**
if (sg == null)
{
- selectAllSequenceMenuItem_actionPerformed(null);
+ alignPanel.selectAllSequences();
return;
}
import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;
+import java.util.ArrayList;
import java.util.List;
import javax.swing.SwingUtilities;
super.repaint();
}
+ public void selectAllSequences()
+ {
+ selectSequences(av.getAlignment().getSequences());
+ }
+
+ public void deselectAllSequences()
+ {
+ if (av.cursorMode)
+ {
+ getSeqPanel().keyboardNo1 = null;
+ getSeqPanel().keyboardNo2 = null;
+ }
+ av.setSelectionGroup(null);
+ av.getColumnSelection().clear();
+ av.setSelectionGroup(null);
+ getIdPanel().getIdCanvas().searchResults = null;
+ av.sendSelection();
+ // JAL-2034 - should delegate to
+ // alignPanel to decide if overview needs
+ // updating.
+ paintAlignment(false, false);
+ PaintRefresher.Refresh(this, av.getSequenceSetId());
+ }
+
+ public void selectSequences(List<SequenceI> seqs)
+ {
+ SequenceGroup sg = new SequenceGroup(seqs);
+ sg.setEndRes(av.getAlignment().getWidth() - 1);
+ av.setSelectionGroup(sg);
+ av.isSelectionGroupChanged(true);
+ av.sendSelection();
+ // JAL-2034 - should delegate to
+ // alignPanel to decide if overview needs
+ // updating.
+ paintAlignment(false, false);
+ PaintRefresher.Refresh(this, av.getSequenceSetId());
+ }
}
public void showStructures(boolean waitUntilFinished)
{
- final StructureSelectionManager ssm = ap.getStructureSelectionManager();
-
final int preferredHeight = pnl_filter.getHeight();
- final StructureViewer theViewer = getTargetedStructureViewer(ssm);
+ final StructureViewer theViewer = getTargetedStructureViewer();
boolean superimpose = chk_superpose.isSelected();
Runnable viewStruc = new Runnable()
if (pdbEntry == null)
{
- pdbEntry = new PDBEntry();
- pdbEntry.setId(pdbIdStr);
- pdbEntry.setType(PDBEntry.Type.PDB);
+ pdbEntry = new PDBEntry(pdbIdStr, null, "pdb");
selectedSeq.getDatasetSequence().addPDBId(pdbEntry);
}
pdbEntriesToView[count++] = pdbEntry;
* @param ssm
* @return
*/
- StructureViewer getTargetedStructureViewer(StructureSelectionManager ssm)
+ StructureViewer getTargetedStructureViewer()
{
- Object sv = targetView.getSelectedItem();
-
- return sv == null ? new StructureViewer(ssm) : (StructureViewer) sv;
+ return (StructureViewer) targetView.getSelectedItem();
}
/**
StructureViewer theViewer, IProgressIndicator pb)
{
final StructureSelectionManager ssm = ap.getStructureSelectionManager();
+ if (theViewer == null)
+ theViewer = new StructureViewer(ssm);
long progressId = sequences.hashCode();
if (pb != null)
pb.setProgressBar(MessageManager.getString(