import jalview.schemes.UserColourScheme;
import jalview.structure.SelectionSource;
import jalview.util.Format;
-import jalview.util.MappingUtils;
import jalview.util.MessageManager;
import java.awt.Color;
return;
}
- if ((node.left() == null) && (node.right() == null)) // TODO: internal node
- {
- node.color = c;
+ node.color = c;
- if (node.element() instanceof SequenceI)
- {
- AlignmentPanel[] aps = getAssociatedPanels();
- if (aps != null)
- {
- for (int a = 0; a < aps.length; a++)
- {
- final SequenceI seq = (SequenceI) node.element();
- aps[a].av.setSequenceColour(seq, c);
- }
- }
- }
- }
- else
+ if ((node.left() != null) || (node.right() != null)) // TODO: internal node
{
- node.color = c;
setColor((SequenceNode) node.left(), c);
setColor((SequenceNode) node.right(), c);
}
c.verdict(false, aps[a].av.getConsPercGaps());
sg.cs.setConservation(c);
}
-
- aps[a].av.getAlignment().addGroup(new SequenceGroup(sg));
- // TODO can we push all of the below into AlignViewportI?
- final AlignViewportI codingComplement = aps[a].av
- .getCodingComplement();
- if (codingComplement != null)
- {
- SequenceGroup mappedGroup = MappingUtils.mapSequenceGroup(sg, av,
- codingComplement);
- if (mappedGroup.getSequences().size() > 0)
- {
- codingComplement.getAlignment().addGroup(mappedGroup);
- for (SequenceI seq : mappedGroup.getSequences())
- {
- codingComplement.setSequenceColour(seq, col.brighter());
- }
- }
- }
// indicate that associated structure views will need an update
aps[a].av.setUpdateStructures(true);
+ // propagate structure view update and sequence group to complement view
+ aps[a].av.addSequenceGroup(new SequenceGroup(sg));
}
}
return update;
}
+ @Override
+ public void addSequenceGroup(SequenceGroup sequenceGroup)
+ {
+ alignment.addGroup(sequenceGroup);
+
+ Color col = sequenceGroup.idColour;
+ if (col != null)
+ {
+ col = col.brighter();
+
+ for (SequenceI sq : sequenceGroup.getSequences())
+ {
+ setSequenceColour(sq, col);
+ }
+ }
+
+ if (codingComplement != null)
+ {
+ SequenceGroup mappedGroup = MappingUtils
+ .mapSequenceGroup(sequenceGroup, this, codingComplement);
+ if (mappedGroup.getSequences().size() > 0)
+ {
+ codingComplement.getAlignment().addGroup(mappedGroup);
+
+ if (col != null)
+ {
+ for (SequenceI seq : mappedGroup.getSequences())
+ {
+ codingComplement.setSequenceColour(seq, col);
+ }
+ }
+ }
+ // propagate the structure view update flag according to our own setting
+ codingComplement.setUpdateStructures(needToUpdateStructureViews);
+ }
+ }
}