error.dbrefsource_implementation_exception =DBRefSource Implementation Exception
error.implementation_error_dbinstance_must_implement_interface = Implmentation Error - getDbInstances must be given a class that implements jalview.ws.seqfetcher.DbSourceProxy (was given{0})
error.implementation_error_must_init_dbsources =Implementation error. Must initialise dbSources
-label.view_controller_toggled_marked = {0} {1} columns containing features of type {2} across {3} sequence(s)
+label.view_controller_toggled_marked = {0} {1} columns {2} features of type {3} across {4} sequence(s)
label.toggled = Toggled
label.marked = Marked
+label.containing = containing
+label.not_containing = not containing
label.not = not
label.no_feature_of_type_found = No features of type {0} found.
label.submission_params = Submission {0}
status.exporting_alignment_as_x_file = Exporting alignment as {0} file
label.column = Column
label.sequence = Sequence
+label.cant_map_cds = Unable to map CDS to protein\nCDS missing or incomplete
+label.operation_failed = Operation failed
error.dbrefsource_implementation_exception = Excepción de implementación DBRefSource
error.implementation_error_dbinstance_must_implement_interface = Error de Implementación- getDbInstances debe recibir una clase que implemente jalview.ws.seqfetcher.DbSourceProxy (recibió {0})
error.implementation_error_must_init_dbsources =Error de implementación. Debe inicializar dbSources
-label.view_controller_toggled_marked = {0} {1} columnas conteniendo características del tipo {2} en {3} secuencia(s)
+label.view_controller_toggled_marked = {0} {1} columnas {2} características del tipo {3} en {4} secuencia(s)
label.toggled = Invertida
label.marked = Marcada
+label.containing = conteniendo
+label.not_containing = no conteniendo
label.not = no
label.no_feature_of_type_found = No se han encontrado características del tipo {0}.
label.submission_params = Envío {0}
status.exporting_alignment_as_x_file = Exportando alineamiento como fichero tipo {0}
label.column = Columna
label.sequence = Secuencia
+label.cant_map_cds = No se pudo mapear CDS a proteína\nDatos CDS faltantes o incompletos
+label.operation_failed = Operación fallada
SequenceI rs = sel.getSequenceAt(0);
start = rs.findIndex(start);
end = rs.findIndex(end);
- if (csel != null)
- {
- List<Integer> cs = csel.getSelected();
- // note - the following actually clears cs as well, since
- // csel.getSelected returns a reference. Need to check if we need to
- // have a concurrentModification exception thrown here
- csel.clear();
- for (Integer selectedCol : cs)
- {
- csel.addElement(rs.findIndex(selectedCol));
- }
+ List<Integer> cs = csel.getSelected();
+ csel.clear();
+ for (Integer selectedCol : cs)
+ {
+ csel.addElement(rs.findIndex(selectedCol));
}
}
sel.setStartRes(start);
avcg.setStatus(MessageManager.formatMessage(
"label.view_controller_toggled_marked",
new String[] {
- (toggle ? MessageManager.getString("label.toggled")
- : MessageManager.getString("label.marked")),
- (invert ? (Integer.valueOf((alw - alStart)
- - bs.cardinality()).toString()) : (Integer
- .valueOf(bs.cardinality()).toString())),
+ MessageManager.getString(toggle ? "label.toggled"
+ : "label.marked"),
+ String.valueOf(invert ? alw - alStart
+ - bs.cardinality() : bs.cardinality()),
+ MessageManager
+ .getString(invert ? "label.not_containing"
+ : "label.containing"),
featureType, Integer.valueOf(nseq).toString() }));
return true;
}
/**
* Returns a list of selected columns. The list contains no duplicates but is
* not necessarily ordered. It also may include columns hidden from the
- * current view
+ * current view. This returns a copy of the actual list, and changes to the
+ * copy will not affect the selection.
*/
public List<Integer> getSelected()
{
- return selection.getList();
+ return new ArrayList<Integer>(selection.getList());
}
/**
* Castor binding file
*
* For example:
- * http://www.ebi.ac.uk/Tools/dbfetch/dbfetch?db=ena_sequence&id=J03321
- * &format=emblxml
+ * http://www.ebi.ac.uk/ena/data/view/J03321&display=xml
*
* @see embl_mapping.xml
*/
public SequenceI getSequence(String sourceDb, List<SequenceI> peptides)
{
SequenceI dna = makeSequence(sourceDb);
+ if (dna == null)
+ {
+ return null;
+ }
dna.setDescription(description);
DBRefEntry retrievedref = new DBRefEntry(sourceDb,
getSequenceVersion(), accession);
*/
SequenceI makeSequence(String sourceDb)
{
+ if (sequence == null)
+ {
+ System.err.println("No sequence was returned for ENA accession "
+ + accession);
+ return null;
+ }
SequenceI dna = new Sequence(sourceDb + "|" + accession,
sequence.getSequence());
return dna;
xrefsAlignment.getSequencesArray());
if (copyAlignment.getHeight() == 0)
{
+ JOptionPane.showMessageDialog(AlignFrame.this,
+ MessageManager.getString("label.cant_map_cds"),
+ MessageManager.getString("label.operation_failed"),
+ JOptionPane.OK_OPTION);
System.err.println("Failed to make CDS alignment");
}
}
else if (evt.getClickCount() == 2)
{
+ boolean invertSelection = evt.isAltDown();
+ boolean ctrlDown = Platform.isControlDown(evt);
+ boolean toggleSelection = ctrlDown;
+ boolean extendSelection = evt.isShiftDown() || ctrlDown;
fr.ap.alignFrame.avc.markColumnsContainingFeatures(
- evt.isAltDown(), evt.isShiftDown() || evt.isMetaDown(),
- evt.isMetaDown(),
+ invertSelection, extendSelection, toggleSelection,
(String) table.getValueAt(selectedRow, 0));
}
}
import jalview.renderer.ScaleRenderer;
import jalview.renderer.ScaleRenderer.ScaleMark;
import jalview.util.MessageManager;
+import jalview.util.Platform;
import java.awt.Color;
import java.awt.FontMetrics;
*/
protected void leftMouseButtonPressed(MouseEvent evt, final int res)
{
- if (!evt.isControlDown() && !evt.isShiftDown())
+ if (!Platform.isControlDown(evt) && !evt.isShiftDown())
{
av.getColumnSelection().clear();
}
return f.toString();
}
+ /**
+ * Answers true if the mouse event has Meta-down (on Mac) or Ctrl-down (on
+ * other o/s)
+ *
+ * @param e
+ * @return
+ */
public static boolean isControlDown(MouseEvent e)
{
- return (jalview.util.Platform.isAMac() ? (Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask() & e.getModifiers()) != 0 : e
- .isControlDown());
+ if (isAMac())
+ {
+ return (Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() & e
+ .getModifiers()) != 0;
+ // could we use e.isMetaDown() here?
+ }
+ return e.isControlDown();
}
}
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertFalse;
+import static org.testng.AssertJUnit.assertNotSame;
import static org.testng.AssertJUnit.assertSame;
import static org.testng.AssertJUnit.assertTrue;
// removing an element in the list removes it
cs.removeElement(2);
+ // ...but not from the copy list!
+ assertEquals(2, sel.size());
+ sel = cs.getSelected();
assertEquals(1, sel.size());
assertEquals(new Integer(5), sel.get(0));
}
{
cs.addElement(col);
}
- List<Integer> selected = cs.getSelected();
- assertEquals(4, selected.size());
+
+ List<Integer> selected1 = cs.getSelected();
+ assertEquals(4, selected1.size());
+
+ /*
+ * getSelected returns a copy, verify the list
+ * is externally immutable
+ */
+ selected1.clear();
+ List<Integer> selected2 = cs.getSelected();
+ assertNotSame(selected1, selected2);
+ assertEquals(4, selected2.size());
int i = 0;
for (int col : sel)
{
- assertEquals(col, selected.get(i++).intValue());
+ assertEquals(col, selected2.get(i++).intValue());
}
cs.removeElement(7);
cs.addElement(1);
cs.removeElement(4);
- selected = cs.getSelected();
- assertEquals(3, selected.size());
- assertEquals(3, selected.get(0).intValue());
- assertEquals(21, selected.get(1).intValue());
- assertEquals(1, selected.get(2).intValue());
+
+ List<Integer> selected3 = cs.getSelected();
+ assertEquals(3, selected3.size());
+ assertEquals(3, selected3.get(0).intValue());
+ assertEquals(21, selected3.get(1).intValue());
+ assertEquals(1, selected3.get(2).intValue());
}
}