public void applyFeaturesStyle(FeatureSettingsModelI featureSettings);
+
+ /**
+ * check if current selection group is defined on the view, or is simply a
+ * temporary group.
+ *
+ * @return true if group is defined on the alignment
+ */
+ boolean isSelectionDefinedGroup();
}
*/
private boolean needOverviewUpdate; // TODO: refactor to avcontroller
- /**
- * set if av.getSelectionGroup() refers to a group that is defined on the
- * alignment view, rather than a transient selection
- */
- private boolean editingDefinedGroup = false; // TODO: refactor to avcontroller
- // or viewModel
-
@Override
public void mouseDragged(MouseEvent evt)
{
&& res < stretchGroup.getEndRes())
{
av.setSelectionGroup(stretchGroup);
- editingDefinedGroup = true;
}
else
{
stretchGroup = null;
- editingDefinedGroup = false;
}
}
&& allGroups[i].getEndRes() >= res)
{
stretchGroup = allGroups[i];
- editingDefinedGroup = true;
break;
}
}
sg.setEndRes(res);
sg.addSequence(sequence, false);
av.setSelectionGroup(sg);
- editingDefinedGroup = false;
stretchGroup = sg;
if (av.getConservationSelected())
// always do this - annotation has own state
// but defer colourscheme update until hidden sequences are passed in
boolean vischange = stretchGroup.recalcConservation(true);
- needOverviewUpdate |= vischange && editingDefinedGroup;
+ // here we rely on stretchGroup == av.getSelection()
+ needOverviewUpdate |= vischange && av.isSelectionDefinedGroup();
if (stretchGroup.cs != null)
{
stretchGroup.cs.alignmentChanged(stretchGroup,
PaintRefresher.Refresh(ap, av.getSequenceSetId());
ap.paintAlignment(needOverviewUpdate);
needOverviewUpdate =false;
- editingDefinedGroup = false;
changeEndRes = false;
changeStartRes = false;
stretchGroup = null;
if (res > (stretchGroup.getStartRes() - 1))
{
stretchGroup.setEndRes(res);
- needOverviewUpdate |= editingDefinedGroup;
+ needOverviewUpdate |= av.isSelectionDefinedGroup();
}
}
else if (changeStartRes)
if (res < (stretchGroup.getEndRes() + 1))
{
stretchGroup.setStartRes(res);
- needOverviewUpdate |= editingDefinedGroup;
+ needOverviewUpdate |= av.isSelectionDefinedGroup();
}
}
if (stretchGroup.getSequences(null).contains(nextSeq))
{
stretchGroup.deleteSequence(seq, false);
- needOverviewUpdate |= editingDefinedGroup;
+ needOverviewUpdate |= av.isSelectionDefinedGroup();
}
else
{
}
stretchGroup.addSequence(nextSeq, false);
- needOverviewUpdate |= editingDefinedGroup;
+ needOverviewUpdate |= av.isSelectionDefinedGroup();
}
}
* set if av.getSelectionGroup() refers to a group that is defined on the
* alignment view, rather than a transient selection
*/
- private boolean editingDefinedGroup = false; // TODO: refactor to avcontroller or viewModel
+ // private boolean editingDefinedGroup = false; // TODO: refactor to
+ // avcontroller or viewModel
/**
* Set status message in alignment panel
&& (res < stretchGroup.getEndRes()))
{
av.setSelectionGroup(stretchGroup);
- editingDefinedGroup = true;
}
else
{
stretchGroup = null;
- editingDefinedGroup = false;
}
}
else if (!stretchGroup.getSequences(null).contains(sequence)
&& (allGroups[i].getEndRes() >= res))
{
stretchGroup = allGroups[i];
- editingDefinedGroup = true;
break;
}
}
sg.setEndRes(res);
sg.addSequence(sequence, false);
av.setSelectionGroup(sg);
- editingDefinedGroup = false;
stretchGroup = sg;
if (av.getConservationSelected())
// always do this - annotation has own state
// but defer colourscheme update until hidden sequences are passed in
boolean vischange = stretchGroup.recalcConservation(true);
- needOverviewUpdate |= vischange && editingDefinedGroup;
+ needOverviewUpdate |= vischange && av.isSelectionDefinedGroup();
if (stretchGroup.cs != null)
{
stretchGroup.cs.alignmentChanged(stretchGroup,
PaintRefresher.Refresh(this, av.getSequenceSetId());
ap.paintAlignment(needOverviewUpdate);
needOverviewUpdate =false;
- editingDefinedGroup = false;
changeEndRes = false;
changeStartRes = false;
stretchGroup = null;
if (res > (stretchGroup.getStartRes() - 1))
{
stretchGroup.setEndRes(res);
- needOverviewUpdate |= editingDefinedGroup;
+ needOverviewUpdate |= av.isSelectionDefinedGroup();
}
}
else if (changeStartRes)
if (res < (stretchGroup.getEndRes() + 1))
{
stretchGroup.setStartRes(res);
- needOverviewUpdate |= editingDefinedGroup;
+ needOverviewUpdate |= av.isSelectionDefinedGroup();
}
}
if (stretchGroup.getSequences(null).contains(nextSeq))
{
stretchGroup.deleteSequence(seq, false);
- needOverviewUpdate |= editingDefinedGroup;
+ needOverviewUpdate |= av.isSelectionDefinedGroup();
}
else
{
}
stretchGroup.addSequence(nextSeq, false);
- needOverviewUpdate |= editingDefinedGroup;
+ needOverviewUpdate |= av.isSelectionDefinedGroup();
}
}
}
}
+ /**
+ * hold status of current selection group - defined on alignment or not.
+ */
+ private boolean selectionIsDefinedGroup = false;
+ @Override
+ public boolean isSelectionDefinedGroup()
+ {
+ if (selectionGroup == null)
+ {
+ return false;
+ }
+ if (isSelectionGroupChanged(true))
+ {
+ selectionIsDefinedGroup = false;
+ List<SequenceGroup> gps = alignment.getGroups();
+ if (gps == null || gps.size() == 0)
+ {
+ selectionIsDefinedGroup = false;
+ }
+ else
+ {
+ selectionIsDefinedGroup = gps.contains(selectionGroup);
+ }
+ }
+ return selectionIsDefinedGroup;
+ }
}