else if (evt.getActionCommand().equals(STEM))
{
type = 'S';
- symbol = "\u03C3";
+ symbol = "(";// "\u03C3"; sigma
}
+ symbol = getCurrentAnnotationCharacter(anot, symbol);
+
if (!aa[activeRow].hasIcons)
{
aa[activeRow].hasIcons = true;
if ((evt.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK
&& activeRow != -1)
{
- if (av.getColumnSelection() == null)
+ if (av.getColumnSelection() == null
+ || av.getColumnSelection().isEmpty())
{
return;
}
PopupMenu pop = new PopupMenu(
MessageManager.getString("label.structure_type"));
MenuItem item;
- /*
- * Just display the needed structure options
- */
- if (av.getAlignment().isNucleotide() == true)
+
+ if (av.getAlignment().isNucleotide())
{
item = new MenuItem(STEM);
item.addActionListener(this);
return null;
}
}
+
+ /**
+ * Returns the current annotation symbol (if any) within the visible selected
+ * columns (first symbol found left to right in selection). If none is found,
+ * the supplied default value is returned.
+ *
+ * @param annotations
+ * @param defaultValue
+ * @return
+ */
+ String getCurrentAnnotationCharacter(Annotation[] annotations,
+ String defaultValue)
+ {
+ String result = defaultValue;
+ for (int index : av.getColumnSelection().getSelected())
+ {
+ if (!av.getColumnSelection().isVisible(index))
+ {
+ continue;
+ }
+
+ Annotation annotation = annotations[index];
+ if (annotation != null)
+ {
+ String displayed = annotation.displayCharacter;
+ if (displayed != null && displayed.length() > 0)
+ {
+ result = displayed.substring(0, 1);
+ break;
+ }
+ }
+ }
+ return result;
+ }
}
// HELIX, SHEET or STEM
{
char type = 0;
- String symbol = "\u03B1";
+ String symbol = "\u03B1"; // alpha
if (evt.getActionCommand().equals(HELIX))
{
else if (evt.getActionCommand().equals(SHEET))
{
type = 'E';
- symbol = "\u03B2";
+ symbol = "\u03B2"; // beta
}
// Added by LML to color stems
else if (evt.getActionCommand().equals(STEM))
{
type = 'S';
- symbol = "\u03C3";
+ symbol = "(";// "\u03C3"; // sigma
}
if (!aa[activeRow].hasIcons)
aa[activeRow].hasIcons = true;
}
+ symbol = getCurrentAnnotationCharacter(anot, symbol);
+
String label = JOptionPane.showInputDialog(MessageManager
.getString("label.enter_label_for_the_structure"), symbol);
return;
}
+ /**
+ * Returns the current annotation symbol (if any) within the visible selected
+ * columns (first symbol found left to right in selection). If none is found,
+ * the supplied default value is returned.
+ *
+ * @param annotations
+ * @param defaultValue
+ * @return
+ */
+ String getCurrentAnnotationCharacter(Annotation[] annotations,
+ String defaultValue)
+ {
+ String result = defaultValue;
+ for (int index : av.getColumnSelection().getSelected())
+ {
+ if (!av.getColumnSelection().isVisible(index))
+ {
+ continue;
+ }
+
+ Annotation annotation = annotations[index];
+ if (annotation != null)
+ {
+ String displayed = annotation.displayCharacter;
+ if (displayed != null && displayed.length() > 0)
+ {
+ result = displayed.substring(0, 1);
+ break;
+ }
+ }
+ }
+ return result;
+ }
+
private String collectAnnotVals(Annotation[] anot, String label2)
{
String collatedInput = "";
if (evt.isPopupTrigger() && activeRow != -1)
{
- if (av.getColumnSelection() == null)
+ if (av.getColumnSelection() == null
+ || av.getColumnSelection().isEmpty())
{
return;
}
/*
* Just display the needed structure options
*/
- if (av.getAlignment().isNucleotide() == true)
+ if (av.getAlignment().isNucleotide())
{
item = new JMenuItem(STEM);
item.addActionListener(this);
return;
}
- if (aa == null)
- {
- return;
- }
-
ap.getScalePanel().mousePressed(evt);
}