}
else if (evt.getActionCommand().equals(LABEL))
{
- String label = JOptionPane.showInputDialog(this, "Enter Label ",
- "Enter label",
- JOptionPane.QUESTION_MESSAGE);
-
+ String exMesg = collectAnnotVals(anot, av.getColumnSelection(), LABEL);
+ String label = JOptionPane.showInputDialog(this,"Enter label",exMesg);
+
if (label == null)
{
return;
if (anot[index] == null)
{
- anot[index] = new Annotation(label, "", ' ', 0);
+ anot[index] = new Annotation(label, "", ' ', 0); // TODO: verify that null exceptions aren't raised elsewhere.
+ } else {
+ anot[index].displayCharacter = label;
}
-
- anot[index].displayCharacter = label;
}
}
else if (evt.getActionCommand().equals(COLOUR))
return;
}
+ private String collectAnnotVals(Annotation[] anot, ColumnSelection columnSelection,
+ String label2)
+ {
+ String collatedInput="";
+ String last="";
+ for (int i = 0; i < columnSelection.size(); i++)
+ {
+ int index = columnSelection.columnAt(i);
+ // always check for current display state - just in case
+ if(!av.colSel.isVisible(index))
+ continue;
+ String tlabel=null;
+ if (anot[index] != null)
+ {
+ if (label2.equals(HELIX) || label2.equals(SHEET) || label2.equals(LABEL))
+ {
+ tlabel = anot[index].description;
+ if (tlabel == null)
+ {
+ if (label2.equals(HELIX) || label2.equals(SHEET))
+ {
+ tlabel = ""+anot[index].secondaryStructure;
+ } else {
+ tlabel = ""+anot[index].displayCharacter;
+ }
+ }
+ }
+ if (tlabel!=null && !tlabel.equals(last))
+ {
+ if (last.length()>0)
+ {
+ collatedInput+=" ";
+ }
+ collatedInput+=tlabel;
+ }
+ }
+ }
+ return collatedInput;
+ }
+
/**
* DOCUMENT ME!
*