if (evt.getActionCommand().equals(REMOVE))
{
- for (int sel : av.getColumnSelection().getSelected())
+ for (int index : av.getColumnSelection().getSelected())
{
- // TODO: JAL-2001 check if applet has faulty 'REMOVE' selected columns
- // of
- // annotation if selection includes hidden columns
- anot[sel] = null;
+ if (av.getColumnSelection().isVisible(index))
+ {
+ anot[index] = null;
+ }
}
}
else if (evt.getActionCommand().equals(LABEL))
if (evt.getActionCommand().equals(REMOVE))
{
- for (int sel : av.getColumnSelection().getSelected())
+ for (int index : av.getColumnSelection().getSelected())
{
- anot[sel] = null;
+ if (av.getColumnSelection().isVisible(index))
+ {
+ anot[index] = null;
+ }
}
}
else if (evt.getActionCommand().equals(LABEL))
return;
}
- private String collectAnnotVals(Annotation[] anot, String label2)
+ /**
+ * Returns any existing annotation concatenated as a string. For each
+ * annotation, takes the description, if any, else the secondary structure
+ * character (if type is HELIX, SHEET or STEM), else the display character (if
+ * type is LABEL).
+ *
+ * @param anots
+ * @param type
+ * @return
+ */
+ private String collectAnnotVals(Annotation[] anots, String type)
{
- String collatedInput = "";
+ // TODO is this method wanted? why? 'last' is not used
+
+ StringBuilder collatedInput = new StringBuilder(64);
String last = "";
ColumnSelection viscols = av.getColumnSelection();
// TODO: refactor and save av.getColumnSelection for efficiency
continue;
}
String tlabel = null;
- if (anot[index] != null)
+ if (anots[index] != null)
{ // LML added stem code
- if (label2.equals(HELIX) || label2.equals(SHEET)
- || label2.equals(STEM) || label2.equals(LABEL))
+ if (type.equals(HELIX) || type.equals(SHEET)
+ || type.equals(STEM) || type.equals(LABEL))
{
- tlabel = anot[index].description;
+ tlabel = anots[index].description;
if (tlabel == null || tlabel.length() < 1)
{
- if (label2.equals(HELIX) || label2.equals(SHEET)
- || label2.equals(STEM))
+ if (type.equals(HELIX) || type.equals(SHEET)
+ || type.equals(STEM))
{
- tlabel = "" + anot[index].secondaryStructure;
+ tlabel = "" + anots[index].secondaryStructure;
}
else
{
- tlabel = "" + anot[index].displayCharacter;
+ tlabel = "" + anots[index].displayCharacter;
}
}
}
{
if (last.length() > 0)
{
- collatedInput += " ";
+ collatedInput.append(" ");
}
- collatedInput += tlabel;
+ collatedInput.append(tlabel);
}
}
}
- return collatedInput;
+ return collatedInput.toString();
}
/**