aa[activeRow].annotations = anot;
}
- if (evt.getActionCommand().equals(REMOVE))
+ String action = evt.getActionCommand();
+ if (action.equals(REMOVE))
{
for (int sel : av.getColumnSelection().getSelected())
{
anot[sel] = null;
}
}
- else if (evt.getActionCommand().equals(LABEL))
+ else if (action.equals(LABEL))
{
String exMesg = collectAnnotVals(anot, LABEL);
String label = JOptionPane.showInputDialog(this,
if (anot[index] == null)
{
- anot[index] = new Annotation(label, "", ' ', 0); // TODO: verify that
- // null exceptions
- // aren't raised
- // elsewhere.
+ anot[index] = new Annotation(label, "", ' ', 0);
}
else
{
}
}
}
- else if (evt.getActionCommand().equals(COLOUR))
+ else if (action.equals(COLOUR))
{
Color col = JColorChooser.showDialog(this,
MessageManager.getString("label.select_foreground_colour"),
char type = 0;
String symbol = "\u03B1"; // alpha
- if (evt.getActionCommand().equals(HELIX))
+ if (action.equals(HELIX))
{
type = 'H';
}
- else if (evt.getActionCommand().equals(SHEET))
+ else if (action.equals(SHEET))
{
type = 'E';
symbol = "\u03B2"; // beta
}
// Added by LML to color stems
- else if (evt.getActionCommand().equals(STEM))
+ else if (action.equals(STEM))
{
type = 'S';
- symbol = "(";// "\u03C3"; // sigma
+ int column = av.getColumnSelection().getSelectedRanges().get(0)[0];
+ symbol = aa[activeRow].getDefaultRnaHelixSymbol(column);
}
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);
if ((label.length() > 0) && !aa[activeRow].hasText)
{
aa[activeRow].hasText = true;
- if (evt.getActionCommand().equals(STEM))
+ if (action.equals(STEM))
{
aa[activeRow].showAllColLabels = true;
}
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 = "";