{
viewport.showAllHiddenColumns();
}
+ viewport.sendSelection();
}
}
else if (source == invertSequenceMenuItem)
{
invertSequenceMenuItem_actionPerformed();
+ // uncomment to slave sequence selections in split frame
+ // viewport.sendSelection();
}
else if (source == invertColSel)
{
viewport.invertColumnSelection();
alignPanel.paintAlignment(true);
+ viewport.sendSelection();
}
else if (source == remove2LeftMenuItem)
{
{
viewport.showAllHiddenColumns();
alignPanel.paintAlignment(true);
+ viewport.sendSelection();
}
else if (source == showSeqs)
{
viewport.showAllHiddenSeqs();
alignPanel.paintAlignment(true);
+ // uncomment if we want to slave sequence selections in split frame
+ // viewport.sendSelection();
}
else if (source == hideColumns)
{
viewport.hideSelectedColumns();
alignPanel.paintAlignment(true);
+ viewport.sendSelection();
}
else if (source == hideSequences
&& viewport.getSelectionGroup() != null)
{
viewport.hideAllSelectedSeqs();
alignPanel.paintAlignment(true);
+ // uncomment if we want to slave sequence selections in split frame
+ // viewport.sendSelection();
}
else if (source == hideAllButSelection)
{
toggleHiddenRegions(false, false);
alignPanel.paintAlignment(true);
+ viewport.sendSelection();
}
else if (source == hideAllSelection)
{
viewport.hideAllSelectedSeqs();
viewport.hideSelectedColumns();
alignPanel.paintAlignment(true);
+ viewport.sendSelection();
}
else if (source == showAllHidden)
{
viewport.showAllHiddenColumns();
viewport.showAllHiddenSeqs();
alignPanel.paintAlignment(true);
+ viewport.sendSelection();
}
else if (source == showGroupConsensus)
{
max = res;
if ((evt.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK)
{
- PopupMenu pop = new PopupMenu();
- if (reveal != null)
+ rightMouseButtonPressed(evt, res);
+ }
+ else
+ {
+ leftMouseButtonPressed(evt, res);
+ }
+ }
+
+ /**
+ * Handles left mouse button pressed (selection / clear selections)
+ *
+ * @param evt
+ * @param res
+ */
+ protected void leftMouseButtonPressed(MouseEvent evt, final int res)
+ {
+ if (!evt.isControlDown() && !evt.isShiftDown())
+ {
+ av.getColumnSelection().clear();
+ }
+
+ av.getColumnSelection().addElement(res);
+ SequenceGroup sg = new SequenceGroup();
+ for (int i = 0; i < av.getAlignment().getSequences().size(); i++)
+ {
+ sg.addSequence(av.getAlignment().getSequenceAt(i), false);
+ }
+
+ sg.setStartRes(res);
+ sg.setEndRes(res);
+ av.setSelectionGroup(sg);
+
+ if (evt.isShiftDown())
+ {
+ int min = Math.min(av.getColumnSelection().getMin(), res);
+ int max = Math.max(av.getColumnSelection().getMax(), res);
+ for (int i = min; i < max; i++)
{
- MenuItem item = new MenuItem(
- MessageManager.getString("label.reveal"));
- item.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- av.showColumn(reveal[0]);
- reveal = null;
- ap.paintAlignment(true);
- if (ap.overviewPanel != null)
- {
- ap.overviewPanel.updateOverviewImage();
- }
- }
- });
- pop.add(item);
+ av.getColumnSelection().addElement(i);
+ }
+ sg.setStartRes(min);
+ sg.setEndRes(max);
+ }
+ ap.paintAlignment(true);
+ av.sendSelection();
+ }
- if (av.getColumnSelection().hasManyHiddenColumns())
+ /**
+ * Handles right mouse button press. If pressed in a selected column, opens
+ * context menu for 'Hide Columns'. If pressed on a hidden columns marker,
+ * opens context menu for 'Reveal / Reveal All'. Else does nothing.
+ *
+ * @param evt
+ * @param res
+ */
+ protected void rightMouseButtonPressed(MouseEvent evt, final int res)
+ {
+ PopupMenu pop = new PopupMenu();
+ if (reveal != null)
+ {
+ MenuItem item = new MenuItem(
+ MessageManager.getString("label.reveal"));
+ item.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
{
- item = new MenuItem(MessageManager.getString("action.reveal_all"));
- item.addActionListener(new ActionListener()
+ av.showColumn(reveal[0]);
+ reveal = null;
+ ap.paintAlignment(true);
+ if (ap.overviewPanel != null)
{
- @Override
- public void actionPerformed(ActionEvent e)
- {
- av.showAllHiddenColumns();
- reveal = null;
- ap.paintAlignment(true);
- if (ap.overviewPanel != null)
- {
- ap.overviewPanel.updateOverviewImage();
- }
- }
- });
- pop.add(item);
+ ap.overviewPanel.updateOverviewImage();
+ }
+ av.sendSelection();
}
- this.add(pop);
- pop.show(this, evt.getX(), evt.getY());
- }
- else if (av.getColumnSelection().contains(res))
+ });
+ pop.add(item);
+
+ if (av.getColumnSelection().hasManyHiddenColumns())
{
- MenuItem item = new MenuItem(
- MessageManager.getString("label.hide_columns"));
+ item = new MenuItem(MessageManager.getString("action.reveal_all"));
item.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
- av.hideColumns(res, res);
- if (av.getSelectionGroup() != null
- && av.getSelectionGroup().getSize() == av
- .getAlignment().getHeight())
- {
- av.setSelectionGroup(null);
- }
-
+ av.showAllHiddenColumns();
+ reveal = null;
ap.paintAlignment(true);
if (ap.overviewPanel != null)
{
ap.overviewPanel.updateOverviewImage();
}
+ av.sendSelection();
}
});
pop.add(item);
- this.add(pop);
- pop.show(this, evt.getX(), evt.getY());
}
+ this.add(pop);
+ pop.show(this, evt.getX(), evt.getY());
}
- else
- // LEFT MOUSE TO SELECT
+ else if (av.getColumnSelection().contains(res))
{
- if (!evt.isControlDown() && !evt.isShiftDown())
- {
- av.getColumnSelection().clear();
- }
-
- av.getColumnSelection().addElement(res);
- SequenceGroup sg = new SequenceGroup();
- for (int i = 0; i < av.getAlignment().getSequences().size(); i++)
- {
- sg.addSequence(av.getAlignment().getSequenceAt(i), false);
- }
-
- sg.setStartRes(res);
- sg.setEndRes(res);
- av.setSelectionGroup(sg);
-
- if (evt.isShiftDown())
+ MenuItem item = new MenuItem(
+ MessageManager.getString("label.hide_columns"));
+ item.addActionListener(new ActionListener()
{
- int min = Math.min(av.getColumnSelection().getMin(), res);
- int max = Math.max(av.getColumnSelection().getMax(), res);
- for (int i = min; i < max; i++)
+ @Override
+ public void actionPerformed(ActionEvent e)
{
- av.getColumnSelection().addElement(i);
+ av.hideColumns(res, res);
+ if (av.getSelectionGroup() != null
+ && av.getSelectionGroup().getSize() == av
+ .getAlignment().getHeight())
+ {
+ av.setSelectionGroup(null);
+ }
+
+ ap.paintAlignment(true);
+ if (ap.overviewPanel != null)
+ {
+ ap.overviewPanel.updateOverviewImage();
+ }
+ av.sendSelection();
}
- sg.setStartRes(min);
- sg.setEndRes(max);
- }
+ });
+ pop.add(item);
+ this.add(pop);
+ pop.show(this, evt.getX(), evt.getY());
}
-
- ap.paintAlignment(true);
- av.sendSelection();
}
@Override
{
viewport.showAllHiddenColumns();
repaint();
+ viewport.sendSelection();
}
@Override
public void hideAllButSelection_actionPerformed(ActionEvent e)
{
toggleHiddenRegions(false, false);
+ viewport.sendSelection();
}
/*
viewport.hideAllSelectedSeqs();
viewport.hideSelectedColumns();
alignPanel.paintAlignment(true);
+ viewport.sendSelection();
}
/*
viewport.showAllHiddenColumns();
viewport.showAllHiddenSeqs();
alignPanel.paintAlignment(true);
+ viewport.sendSelection();
}
@Override
{
viewport.hideSelectedColumns();
alignPanel.paintAlignment(true);
+ viewport.sendSelection();
}
@Override
if (SwingUtilities.isRightMouseButton(evt))
{
- JPopupMenu pop = new JPopupMenu();
- if (reveal != null)
+ rightMouseButtonPressed(evt, res);
+ }
+ else
+ {
+ leftMouseButtonPressed(evt, res);
+ }
+ }
+
+ /**
+ * Handles right mouse button press. If pressed in a selected column, opens
+ * context menu for 'Hide Columns'. If pressed on a hidden columns marker,
+ * opens context menu for 'Reveal / Reveal All'. Else does nothing.
+ *
+ * @param evt
+ * @param res
+ */
+ protected void rightMouseButtonPressed(MouseEvent evt, final int res)
+ {
+ JPopupMenu pop = new JPopupMenu();
+ if (reveal != null)
+ {
+ JMenuItem item = new JMenuItem(
+ MessageManager.getString("label.reveal"));
+ item.addActionListener(new ActionListener()
{
- JMenuItem item = new JMenuItem(
- MessageManager.getString("label.reveal"));
- item.addActionListener(new ActionListener()
+ @Override
+ public void actionPerformed(ActionEvent e)
{
- @Override
- public void actionPerformed(ActionEvent e)
+ av.showColumn(reveal[0]);
+ reveal = null;
+ ap.paintAlignment(true);
+ if (ap.overviewPanel != null)
{
- av.showColumn(reveal[0]);
- reveal = null;
- ap.paintAlignment(true);
- if (ap.overviewPanel != null)
- {
- ap.overviewPanel.updateOverviewImage();
- }
+ ap.overviewPanel.updateOverviewImage();
}
- });
- pop.add(item);
-
- if (av.getColumnSelection().hasHiddenColumns())
- {
- item = new JMenuItem(
- MessageManager.getString("action.reveal_all"));
- item.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- av.showAllHiddenColumns();
- reveal = null;
- ap.paintAlignment(true);
- if (ap.overviewPanel != null)
- {
- ap.overviewPanel.updateOverviewImage();
- }
- }
- });
- pop.add(item);
+ av.sendSelection();
}
- pop.show(this, evt.getX(), evt.getY());
- }
- else if (av.getColumnSelection().contains(res))
+ });
+ pop.add(item);
+
+ if (av.getColumnSelection().hasHiddenColumns())
{
- JMenuItem item = new JMenuItem(
- MessageManager.getString("label.hide_columns"));
+ item = new JMenuItem(MessageManager.getString("action.reveal_all"));
item.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
- av.hideColumns(res, res);
- if (av.getSelectionGroup() != null
- && av.getSelectionGroup().getSize() == av
- .getAlignment().getHeight())
- {
- av.setSelectionGroup(null);
- }
-
+ av.showAllHiddenColumns();
+ reveal = null;
ap.paintAlignment(true);
if (ap.overviewPanel != null)
{
}
});
pop.add(item);
- pop.show(this, evt.getX(), evt.getY());
}
+ pop.show(this, evt.getX(), evt.getY());
}
- else
- // LEFT MOUSE TO SELECT
+ else if (av.getColumnSelection().contains(res))
{
- if (!evt.isControlDown() && !evt.isShiftDown())
+ JMenuItem item = new JMenuItem(
+ MessageManager.getString("label.hide_columns"));
+ item.addActionListener(new ActionListener()
{
- av.getColumnSelection().clear();
- }
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ av.hideColumns(res, res);
+ if (av.getSelectionGroup() != null
+ && av.getSelectionGroup().getSize() == av.getAlignment()
+ .getHeight())
+ {
+ av.setSelectionGroup(null);
+ }
- av.getColumnSelection().addElement(res);
- SequenceGroup sg = new SequenceGroup();
- // try to be as quick as possible
- SequenceI[] iVec = av.getAlignment().getSequencesArray();
- for (int i = 0; i < iVec.length; i++)
- {
- sg.addSequence(iVec[i], false);
- iVec[i] = null;
- }
- iVec = null;
- sg.setStartRes(res);
- sg.setEndRes(res);
+ ap.paintAlignment(true);
+ if (ap.overviewPanel != null)
+ {
+ ap.overviewPanel.updateOverviewImage();
+ }
+ av.sendSelection();
+ }
+ });
+ pop.add(item);
+ pop.show(this, evt.getX(), evt.getY());
+ }
+ }
- if (evt.isShiftDown())
+ /**
+ * Handles left mouse button press
+ *
+ * @param evt
+ * @param res
+ */
+ protected void leftMouseButtonPressed(MouseEvent evt, final int res)
+ {
+ if (!evt.isControlDown() && !evt.isShiftDown())
+ {
+ av.getColumnSelection().clear();
+ }
+
+ av.getColumnSelection().addElement(res);
+ SequenceGroup sg = new SequenceGroup();
+ // try to be as quick as possible
+ SequenceI[] iVec = av.getAlignment().getSequencesArray();
+ for (int i = 0; i < iVec.length; i++)
+ {
+ sg.addSequence(iVec[i], false);
+ iVec[i] = null;
+ }
+ iVec = null;
+ sg.setStartRes(res);
+ sg.setEndRes(res);
+
+ if (evt.isShiftDown())
+ {
+ int min = Math.min(av.getColumnSelection().getMin(), res);
+ int max = Math.max(av.getColumnSelection().getMax(), res);
+ for (int i = min; i < max; i++)
{
- int min = Math.min(av.getColumnSelection().getMin(), res);
- int max = Math.max(av.getColumnSelection().getMax(), res);
- for (int i = min; i < max; i++)
- {
- av.getColumnSelection().addElement(i);
- }
- sg.setStartRes(min);
- sg.setEndRes(max);
+ av.getColumnSelection().addElement(i);
}
- av.setSelectionGroup(sg);
+ sg.setStartRes(min);
+ sg.setEndRes(max);
}
-
+ av.setSelectionGroup(sg);
ap.paintAlignment(false);
av.sendSelection();
}