{
copiedHiddenColumns = new Vector();
int hiddenOffset = viewport.getSelectionGroup().getStartRes();
- for (int i = 0; i < viewport.getColumnSelection().getHiddenColumns()
- .size(); i++)
+ for (int[] region : viewport.getColumnSelection().getHiddenColumns())
{
- int[] region = (int[]) viewport.getColumnSelection()
- .getHiddenColumns().elementAt(i);
copiedHiddenColumns.addElement(new int[]
{ region[0] - hiddenOffset, region[1] - hiddenOffset });
if (av.hasHiddenColumns())
{
jalview.appletgui.AlignFrame.copiedHiddenColumns = new Vector();
- for (int i = 0; i < av.getColumnSelection().getHiddenColumns().size(); i++)
+ for (int[] region : av.getColumnSelection().getHiddenColumns())
{
- int[] region = (int[]) av.getColumnSelection().getHiddenColumns()
- .elementAt(i);
-
jalview.appletgui.AlignFrame.copiedHiddenColumns
.addElement(new int[]
{ region[0], region[1] });
*/
package jalview.appletgui;
-import java.awt.*;
-import java.awt.event.*;
-
-import jalview.datamodel.*;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.SequenceGroup;
import jalview.util.MessageManager;
+import java.awt.Color;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.MenuItem;
+import java.awt.Panel;
+import java.awt.PopupMenu;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.InputEvent;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+
public class ScalePanel extends Panel implements MouseMotionListener,
MouseListener
{
});
pop.add(item);
- if (av.getColumnSelection().getHiddenColumns().size() > 1)
+ if (av.getColumnSelection().hasHiddenColumns())
{
item = new MenuItem(MessageManager.getString("action.reveal_all"));
item.addActionListener(new ActionListener()
res = av.getColumnSelection().adjustForHiddenColumns(res);
reveal = null;
- for (int i = 0; i < av.getColumnSelection().getHiddenColumns().size(); i++)
+ for (int[] region : av.getColumnSelection().getHiddenColumns())
{
- int[] region = (int[]) av.getColumnSelection().getHiddenColumns()
- .elementAt(i);
if (res + 1 == region[0] || res - 1 == region[1])
{
reveal = region;
}
gg.drawLine(
- (int) (((i - startx - 1) * av.charWidth) + (av.charWidth / 2)),
+ ((i - startx - 1) * av.charWidth) + (av.charWidth / 2),
y + 2,
- (int) (((i - startx - 1) * av.charWidth) + (av.charWidth / 2)),
+ ((i - startx - 1) * av.charWidth) + (av.charWidth / 2),
y + (fm.getDescent() * 2));
}
else
{
gg.drawLine(
- (int) (((i - startx - 1) * av.charWidth) + (av.charWidth / 2)),
+ ((i - startx - 1) * av.charWidth) + (av.charWidth / 2),
y + fm.getDescent(),
- (int) (((i - startx - 1) * av.charWidth) + (av.charWidth / 2)),
+ ((i - startx - 1) * av.charWidth) + (av.charWidth / 2),
y + (fm.getDescent() * 2));
}
}
*/
package jalview.appletgui;
-import java.awt.*;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SearchResults;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
-import jalview.datamodel.*;
+import java.awt.Color;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.Panel;
public class SeqCanvas extends Panel
{
}
else
{
- java.util.Vector regions = av.getColumnSelection().getHiddenColumns();
+ java.util.List<int[]> regions = av.getColumnSelection()
+ .getHiddenColumns();
int screenY = 0;
int blockStart = startRes;
for (int i = 0; i < regions.size(); i++)
{
- int[] region = (int[]) regions.elementAt(i);
+ int[] region = regions.get(i);
int hideStart = region[0];
int hideEnd = region[1];
if ((group == null) && (av.getAlignment().getGroups().size() > 0))
{
- group = (SequenceGroup) av.getAlignment().getGroups().get(0);
+ group = av.getAlignment().getGroups().get(0);
groupIndex = 0;
}
break;
}
- group = (SequenceGroup) av.getAlignment().getGroups()
+ group = av.getAlignment().getGroups()
.get(groupIndex);
} while (groupIndex < av.getAlignment().getGroups().size());
*/
package jalview.datamodel;
-import java.util.Vector;
+import java.util.List;
public class CigarArray extends CigarBase
{
* internal constructor function - called by CigarArray(AlignmentI, ...);
*
* @param alignment
- * @param columnSelection
+ * @param list
* - vector of visible regions as returned from
* columnSelection.getHiddenColumns()
* @param selectionGroup
*/
private void constructFromAlignment(AlignmentI alignment,
- Vector columnSelection, SequenceGroup selectionGroup)
+ List<int[]> list, SequenceGroup selectionGroup)
{
int[] _startend = _calcStartEndBounds(alignment, selectionGroup);
int start = _startend[1], end = _startend[2];
// now construct the CigarArray operations
- if (columnSelection != null)
+ if (list != null)
{
int[] region;
int hideStart, hideEnd;
int last = start;
- for (int j = 0; last < end & j < columnSelection.size(); j++)
+ for (int j = 0; last < end & j < list.size(); j++)
{
- region = (int[]) columnSelection.elementAt(j);
+ region = list.get(j);
hideStart = region[0];
hideEnd = region[1];
// edit hidden regions to selection range
Vector selected = new Vector();
// Vector of int [] {startCol, endCol}
- Vector hiddenColumns;
+ Vector<int[]> hiddenColumns;
/**
* Add a column to the selection
int hSize = hiddenColumns.size();
for (int i = 0; i < hSize; i++)
{
- int[] region = (int[]) hiddenColumns.elementAt(i);
+ int[] region = hiddenColumns.elementAt(i);
if (region[0] > start && start + change > region[1])
{
deletedHiddenColumns.add(region);
{
for (int i = 0; i < hiddenColumns.size(); i++)
{
- int[] region = (int[]) hiddenColumns.elementAt(i);
+ int[] region = hiddenColumns.elementAt(i);
if (region[0] >= start)
{
region[0] -= change;
* int
* @return Vector
*/
- public Vector getHiddenColumns()
+ public List<int[]> getHiddenColumns()
{
return hiddenColumns;
}
{
for (int i = 0; i < hiddenColumns.size(); i++)
{
- int[] region = (int[]) hiddenColumns.elementAt(i);
+ int[] region = hiddenColumns.elementAt(i);
if (result >= region[0])
{
result += region[1] - region[0] + 1;
int[] region;
do
{
- region = (int[]) hiddenColumns.elementAt(index++);
+ region = hiddenColumns.elementAt(index++);
if (hiddenColumn > region[1])
{
result -= region[1] + 1 - region[0];
int gaps = 0;
do
{
- int[] region = (int[]) hiddenColumns.elementAt(index);
+ int[] region = hiddenColumns.elementAt(index);
if (hiddenRegion == 0)
{
return region[0];
int index = 0;
do
{
- int[] region = (int[]) hiddenColumns.elementAt(index);
+ int[] region = hiddenColumns.elementAt(index);
if (alPos < region[0])
{
return region[0];
int index = hiddenColumns.size() - 1;
do
{
- int[] region = (int[]) hiddenColumns.elementAt(index);
+ int[] region = hiddenColumns.elementAt(index);
if (alPos > region[1])
{
return region[1];
for (int i = 0; i < hiddenColumns.size(); i++)
{
- int[] region = (int[]) hiddenColumns.elementAt(i);
+ int[] region = hiddenColumns.elementAt(i);
if (start <= region[1] && end >= region[0])
{
hiddenColumns.removeElementAt(i);
{
for (int i = 0; i < hiddenColumns.size(); i++)
{
- int[] region = (int[]) hiddenColumns.elementAt(i);
+ int[] region = hiddenColumns.elementAt(i);
for (int j = region[0]; j < region[1] + 1; j++)
{
addElement(j);
{
for (int i = 0; i < hiddenColumns.size(); i++)
{
- int[] region = (int[]) hiddenColumns.elementAt(i);
+ int[] region = hiddenColumns.elementAt(i);
if (res == region[0])
{
for (int j = region[0]; j < region[1] + 1; j++)
{
for (int i = 0; i < hiddenColumns.size(); i++)
{
- int[] region = (int[]) hiddenColumns.elementAt(i);
+ int[] region = hiddenColumns.elementAt(i);
if (column >= region[0] && column <= region[1])
{
return false;
for (int i = 0, j = copy.hiddenColumns.size(); i < j; i++)
{
int[] rh, cp;
- rh = (int[]) copy.hiddenColumns.elementAt(i);
+ rh = copy.hiddenColumns.elementAt(i);
if (rh != null)
{
cp = new int[rh.length];
for (i = 0; i < iSize; i++)
{
StringBuffer visibleSeq = new StringBuffer();
- Vector regions = getHiddenColumns();
+ List<int[]> regions = getHiddenColumns();
int blockStart = start, blockEnd = end;
int[] region;
for (int j = 0; j < regions.size(); j++)
{
- region = (int[]) regions.elementAt(j);
+ region = regions.get(j);
hideStart = region[0];
hideEnd = region[1];
if (hiddenColumns != null && hiddenColumns.size() > 0)
{
Vector visiblecontigs = new Vector();
- Vector regions = getHiddenColumns();
+ List<int[]> regions = getHiddenColumns();
int vstart = start;
int[] region;
for (int j = 0; vstart < end && j < regions.size(); j++)
{
- region = (int[]) regions.elementAt(j);
+ region = regions.get(j);
hideStart = region[0];
hideEnd = region[1];
// then mangle the alignmentAnnotation annotation array
Vector annels = new Vector();
Annotation[] els = null;
- Vector regions = getHiddenColumns();
+ List<int[]> regions = getHiddenColumns();
int blockStart = start, blockEnd = end;
int[] region;
int hideStart, hideEnd, w = 0;
for (int j = 0; j < regions.size(); j++)
{
- region = (int[]) regions.elementAt(j);
+ region = regions.get(j);
hideStart = region[0];
hideEnd = region[1];
return;
}
- Vector hiddenColumns = null;
+ ArrayList<int[]> hiddenColumns = null;
if (viewport.hasHiddenColumns())
{
- hiddenColumns = new Vector();
+ hiddenColumns = new ArrayList<int[]>();
int hiddenOffset = viewport.getSelectionGroup().getStartRes(), hiddenCutoff = viewport
.getSelectionGroup().getEndRes();
- for (int i = 0; i < viewport.getColumnSelection().getHiddenColumns()
- .size(); i++)
+ for (int[] region : viewport.getColumnSelection().getHiddenColumns())
{
- int[] region = (int[]) viewport.getColumnSelection()
- .getHiddenColumns().elementAt(i);
if (region[0] >= hiddenOffset && region[1] <= hiddenCutoff)
{
- hiddenColumns.addElement(new int[]
+ hiddenColumns.add(new int[]
{ region[0] - hiddenOffset, region[1] - hiddenOffset });
}
}
if (Desktop.jalviewClipboard != null
&& Desktop.jalviewClipboard[2] != null)
{
- Vector hc = (Vector) Desktop.jalviewClipboard[2];
- for (int i = 0; i < hc.size(); i++)
+ List<int[]> hc = (List<int[]>) Desktop.jalviewClipboard[2];
+ for (int[] region : hc)
{
- int[] region = (int[]) hc.elementAt(i);
af.viewport.hideColumns(region[0], region[1]);
}
}
if (Desktop.jalviewClipboard != null
&& Desktop.jalviewClipboard[2] != null)
{
- Vector hc = (Vector) Desktop.jalviewClipboard[2];
- for (int i = 0; i < hc.size(); i++)
+ List<int[]> hc = (List<int[]>) Desktop.jalviewClipboard[2];
+ for (int region[] : hc)
{
- int[] region = (int[]) hc.elementAt(i);
af.viewport.hideColumns(region[0], region[1]);
}
}
import java.awt.event.MouseMotionListener;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
+import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Vector;
import java.util.regex.Pattern;
import javax.swing.JCheckBoxMenuItem;
Toolkit.getDefaultToolkit().getSystemClipboard()
.setContents(new StringSelection(output), Desktop.instance);
- Vector hiddenColumns = null;
+ ArrayList<int[]> hiddenColumns = null;
if (av.hasHiddenColumns())
{
- hiddenColumns = new Vector();
- for (int i = 0; i < av.getColumnSelection().getHiddenColumns().size(); i++)
+ hiddenColumns = new ArrayList<int[]>();
+ for (int[] region : av.getColumnSelection().getHiddenColumns())
{
- int[] region = (int[]) av.getColumnSelection().getHiddenColumns()
- .elementAt(i);
-
- hiddenColumns.addElement(new int[]
+ hiddenColumns.add(new int[]
{ region[0], region[1] });
}
}
for (int c = 0; c < av.getColumnSelection().getHiddenColumns()
.size(); c++)
{
- int[] region = (int[]) av.getColumnSelection()
- .getHiddenColumns().elementAt(c);
+ int[] region = av.getColumnSelection()
+ .getHiddenColumns().get(c);
HiddenColumns hc = new HiddenColumns();
hc.setStart(region[0]);
hc.setEnd(region[1]);
});
pop.add(item);
- if (av.getColumnSelection().getHiddenColumns().size() > 1)
+ if (av.getColumnSelection().hasHiddenColumns())
{
item = new JMenuItem(
MessageManager.getString("action.reveal_all"));
reveal = null;
if (av.getColumnSelection().getHiddenColumns() != null)
{
- for (int i = 0; i < av.getColumnSelection().getHiddenColumns().size(); i++)
- {
- int[] region = (int[]) av.getColumnSelection().getHiddenColumns()
- .elementAt(i);
- if (res + 1 == region[0] || res - 1 == region[1])
- {
- reveal = region;
- ToolTipManager.sharedInstance().registerComponent(this);
- this.setToolTipText(MessageManager
- .getString("label.reveal_hidden_columns"));
- break;
- }
- else
+ for (int[] region : av.getColumnSelection().getHiddenColumns())
{
- this.setToolTipText(null);
+ if (res + 1 == region[0] || res - 1 == region[1])
+ {
+ reveal = region;
+ ToolTipManager.sharedInstance().registerComponent(this);
+ this.setToolTipText(MessageManager
+ .getString("label.reveal_hidden_columns"));
+ break;
+ }
+ else
+ {
+ this.setToolTipText(null);
+ }
}
-
- }
}
repaint();
}
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.image.BufferedImage;
+import java.util.List;
import javax.swing.JComponent;
}
else
{
- java.util.Vector regions = av.getColumnSelection().getHiddenColumns();
+ List<int[]> regions = av.getColumnSelection().getHiddenColumns();
int screenY = 0;
int blockStart = startRes;
for (int i = 0; regions != null && i < regions.size(); i++)
{
- int[] region = (int[]) regions.elementAt(i);
+ int[] region = regions.get(i);
int hideStart = region[0];
int hideEnd = region[1];