MenuItem toUpper = new MenuItem("To Upper Case");\r
MenuItem toLower = new MenuItem("To Lower Case");\r
MenuItem toggleCase = new MenuItem("Toggle Case");\r
+ Menu outputmenu = new Menu();\r
+ Menu seqMenu = new Menu();\r
+ MenuItem pdb = new MenuItem();\r
+ MenuItem hideSeqs = new MenuItem();\r
+ MenuItem repGroup = new MenuItem();\r
+\r
+ Sequence seq;\r
+ MenuItem revealAll = new MenuItem();\r
\r
public APopupMenu(AlignmentPanel apanel, final Sequence seq, Vector links)\r
{\r
//////////////////////////////////////////////////////////\r
\r
this.ap = apanel;\r
+ this.seq = seq;\r
\r
try\r
{\r
e.printStackTrace();\r
}\r
\r
+ for (int i = 0; i < jalview.io.AppletFormatAdapter.formats.size()-1; i++)\r
+ {\r
+ MenuItem item = new MenuItem( (String) jalview.io.AppletFormatAdapter.formats.\r
+ elementAt(\r
+ i));\r
+ item.addActionListener(this);\r
+ outputmenu.add(item);\r
+ }\r
+\r
SequenceGroup sg = ap.av.getSelectionGroup();\r
\r
if (sg != null && sg.getSize(false)>0)\r
else\r
{\r
remove(groupMenu);\r
- remove(editMenu);\r
}\r
\r
if (links!=null)\r
});\r
linkMenu.add(item);\r
}\r
- add(linkMenu);\r
-\r
- if(seq!=null)\r
- {\r
- item = new MenuItem("Show PDB Structure");\r
- item.addActionListener(new java.awt.event.ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- addPDB(seq);\r
- }\r
- });\r
-\r
- add(item);\r
- }\r
+ seqMenu.add(linkMenu);\r
}\r
+ if(seq!=null)\r
+ {\r
+ seqMenu.setLabel(seq.getName());\r
+ repGroup.setLabel("Represent Group with " + seq.getName());\r
+ }\r
+ else\r
+ remove(seqMenu);\r
+\r
+ if(!ap.av.hasHiddenRows)\r
+ remove(revealAll);\r
}\r
\r
public void itemStateChanged(ItemEvent evt)\r
else if(source==nucleotideMenuItem)\r
nucleotideMenuItem_actionPerformed();\r
\r
- else if(source==userDefinedColour)\r
- userDefinedColour_actionPerformed();\r
- else if(source==PIDColour)\r
- PIDColour_actionPerformed();\r
- else if(source==BLOSUM62Colour)\r
+ else if (source == userDefinedColour)\r
+ userDefinedColour_actionPerformed();\r
+ else if (source == PIDColour)\r
+ PIDColour_actionPerformed();\r
+ else if (source == BLOSUM62Colour)\r
BLOSUM62Colour_actionPerformed();\r
- else if(source==noColourmenuItem)\r
+ else if (source == noColourmenuItem)\r
noColourmenuItem_actionPerformed();\r
- else if(source==conservationMenuItem)\r
- conservationMenuItem_itemStateChanged();\r
- else if(source==unGroupMenuItem)\r
+ else if (source == conservationMenuItem)\r
+ conservationMenuItem_itemStateChanged();\r
+ else if (source == unGroupMenuItem)\r
unGroupMenuItem_actionPerformed();\r
\r
+ else if(source == pdb)\r
+ addPDB();\r
+ else if(source == hideSeqs)\r
+ hideSequences(false);\r
+ else if(source == repGroup)\r
+ hideSequences(true);\r
+ else if(source == revealAll)\r
+ {\r
+ ap.av.showAllHiddenSeqs();\r
+ ap.repaint();\r
+ }\r
+\r
else if(source==copy)\r
ap.alignFrame.copy_actionPerformed();\r
else if(source==cut)\r
ap.seqPanel.seqCanvas.repaint();\r
}\r
}\r
+ else\r
+ outputText(evt);\r
+\r
+ }\r
+\r
+ void outputText(ActionEvent e)\r
+ {\r
+ CutAndPasteTransfer cap = new CutAndPasteTransfer(false, ap.alignFrame);\r
+ Vector vseqs = new Vector();\r
+\r
+ String [] selection = ap.av.getViewAsString(true);\r
+ SequenceI [] seqs = ap.av.getSelectionAsNewSequence();\r
+ if (selection != null)\r
+ {\r
+ for (int i = 0; i < selection.length; i++)\r
+ {\r
+ Sequence seq = new Sequence(\r
+ seqs[i].getName(),\r
+ selection[i],\r
+ seqs[i].getStart(), seqs[i].getEnd());\r
+ seq.setDescription(seqs[i].getDescription());\r
+ vseqs.addElement( seq );\r
+ }\r
+ }\r
+\r
+ Frame frame = new Frame();\r
+ frame.add(cap);\r
+ jalview.bin.JalviewLite.addFrame(frame,\r
+ "Selection output - " + e.getActionCommand(),\r
+ 600, 500);\r
+\r
+ cap.setText(new jalview.io.AppletFormatAdapter().formatSequences(\r
+ e.getActionCommand(),\r
+ vseqs,\r
+ ap.av.showJVSuffix));\r
\r
}\r
\r
- void addPDB(Sequence seq)\r
+ void addPDB()\r
{\r
CutAndPasteTransfer cap = new CutAndPasteTransfer(true, ap.alignFrame);\r
cap.setText("Paste your PDB file here.");\r
throws Exception\r
{\r
groupMenu.setLabel("Group");\r
- groupMenu.setLabel("Define");\r
+ groupMenu.setLabel("Selection");\r
\r
unGroupMenuItem.setLabel("Remove Group");\r
unGroupMenuItem.addActionListener(this);\r
showText.addItemListener(this);\r
showColourText.setLabel("Colour Text");\r
showColourText.addItemListener(this);\r
+ outputmenu.setLabel("Output to Textbox...");\r
+ seqMenu.setLabel("Sequence");\r
+ pdb.setLabel("View PDB Structure");\r
+ hideSeqs.setLabel("Hide Sequences");\r
+ repGroup.setLabel("Represent Group with");\r
+ revealAll.setLabel("Reveal All");\r
\r
add(groupMenu);\r
+ this.add(seqMenu);\r
+ this.add(hideSeqs);\r
+ this.add(revealAll);\r
+ groupMenu.add(editMenu);\r
+ groupMenu.add(outputmenu);\r
+ groupMenu.addSeparator();\r
groupMenu.add(unGroupMenuItem);\r
groupMenu.add(colourMenu);\r
- groupMenu.addSeparator();\r
groupMenu.add(showBoxes);\r
groupMenu.add(showText);\r
groupMenu.add(showColourText);\r
BLOSUM62Colour.addActionListener(this);\r
conservationMenuItem.setLabel("Conservation");\r
\r
- add(editMenu);\r
editMenu.add(copy);\r
copy.addActionListener(this);\r
editMenu.add(cut);\r
editMenu.add(toLower);\r
toLower.addActionListener(this);\r
editMenu.add(toggleCase);\r
+ seqMenu.add(pdb);\r
+ seqMenu.add(repGroup);\r
toggleCase.addActionListener(this);\r
+ pdb.addActionListener(this);\r
+ hideSeqs.addActionListener(this);\r
+ repGroup.addActionListener(this);\r
+ revealAll.addActionListener(this);\r
\r
}\r
\r
refresh();\r
}\r
\r
+ void hideSequences(boolean representGroup)\r
+ {\r
+ SequenceGroup sg = ap.av.getSelectionGroup();\r
+ if(sg==null || sg.getSize(false)<1)\r
+ {\r
+ ap.av.hideSequence(seq);\r
+ return;\r
+ }\r
+\r
+ int index = 0;\r
+ while(index < sg.getSize(false))\r
+ {\r
+ if(representGroup && sg.getSequenceAt(index)!=seq)\r
+ {\r
+ seq.addHiddenSequence(sg.getSequenceAt(index));\r
+ ap.av.hideSequence(sg.getSequenceAt(index));\r
+ }\r
+ else if(!representGroup)\r
+ {\r
+ ap.av.hideSequence(sg.getSequenceAt(index));\r
+ }\r
+ index ++;\r
+ }\r
+\r
+ ap.av.setSelectionGroup(null);\r
+ ap.repaint();\r
+ refresh();\r
+ }\r
+\r
}\r
public AlignViewport viewport;\r
int NEW_WINDOW_WIDTH = 700;\r
int NEW_WINDOW_HEIGHT = 500;\r
- jalview.bin.JalviewLite applet;\r
\r
String jalviewServletURL;\r
\r
ex.printStackTrace();\r
}\r
\r
- this.applet = applet;\r
viewport = new AlignViewport(al, applet);\r
alignPanel = new AlignmentPanel(this, viewport);\r
\r
StringBuffer url = new StringBuffer(jalviewServletURL);\r
\r
url.append("?open="+\r
- appendProtocol( applet.getParameter("file") ) );\r
+ appendProtocol( viewport.applet.getParameter("file") ) );\r
\r
- if(applet.getParameter("features")!=null)\r
+ if(viewport.applet.getParameter("features")!=null)\r
{\r
url.append( "&features=" );\r
- url.append( appendProtocol( applet.getParameter("features") ) );\r
+ url.append( appendProtocol( viewport.applet.getParameter("features") ) );\r
}\r
\r
- if(applet.getParameter("defaultColour")!=null)\r
+ if(viewport.applet.getParameter("defaultColour")!=null)\r
{\r
url.append("&colour=" +\r
- removeWhiteSpace(applet.getParameter("defaultColour"))\r
+ removeWhiteSpace(viewport.applet.getParameter("defaultColour"))\r
);\r
}\r
\r
- if(applet.getParameter("userDefinedColour")!=null)\r
+ if(viewport.applet.getParameter("userDefinedColour")!=null)\r
{\r
url.append( "&colour=" +\r
- removeWhiteSpace( applet.getParameter("userDefinedColour") )\r
+ removeWhiteSpace( viewport.applet.getParameter("userDefinedColour") )\r
);\r
}\r
\r
new URL(url);\r
}catch(java.net.MalformedURLException ex)\r
{\r
- url = applet.getCodeBase()+url;\r
+ url = viewport.applet.getCodeBase()+url;\r
}\r
return url;\r
}\r
public void closeMenuItem_actionPerformed()\r
{\r
PaintRefresher.components.remove(viewport.alignment);\r
- if(PaintRefresher.components.size()==0 && applet==null)\r
+ if(PaintRefresher.components.size()==0 && viewport.applet==null)\r
System.exit(0);\r
\r
this.dispose();\r
newtitle = newtitle.concat("- from " + getTitle());\r
}\r
AlignFrame af = new AlignFrame(new Alignment(newSeqs),\r
- applet,\r
+ viewport.applet,\r
newtitle,\r
false);\r
\r
\r
public void showURL(String url, String target)\r
{\r
- if (applet == null)\r
+ if (viewport.applet == null)\r
{\r
System.out.println("Not running as applet - no browser available.");\r
}\r
try\r
{\r
System.out.println("Show url: "+url);\r
- applet.getAppletContext().showDocument(new java.net.URL(url),\r
+ viewport.applet.getAppletContext().showDocument(new java.net.URL(url),\r
target);\r
}\r
catch (Exception ex)\r
fileMenu.remove(closeMenuItem);\r
fileMenu.remove(3); // Seperator\r
\r
- applet.setLayout(new BorderLayout());\r
- applet.add(embeddedMenu, BorderLayout.NORTH);\r
- applet.add(statusBar, BorderLayout.SOUTH);\r
- // applet.validate();\r
+ viewport.applet.setLayout(new BorderLayout());\r
+ viewport.applet.add(embeddedMenu, BorderLayout.NORTH);\r
+ viewport.applet.add(statusBar, BorderLayout.SOUTH);\r
+ // viewport.applet.validate();\r
\r
- alignPanel.setSize(applet.size().width, applet.size().height\r
+ alignPanel.setSize(viewport.applet.size().width, viewport.applet.size().height\r
- embeddedMenu.HEIGHT - statusBar.HEIGHT);\r
\r
- applet.add(alignPanel, BorderLayout.CENTER);\r
- applet.validate();\r
+ viewport.applet.add(alignPanel, BorderLayout.CENTER);\r
+ viewport.applet.validate();\r
\r
}\r
\r
// currently visible, in the correct order or rendering\r
Hashtable featuresDisplayed;\r
\r
+ boolean hasHiddenColumns = false;\r
+ boolean hasHiddenRows = false;\r
+ boolean showHiddenMarkers = true;\r
+\r
\r
public Vector vconsensus;\r
AlignmentAnnotation consensus;\r
\r
boolean ignoreGapsInConsensusCalculation = false;\r
\r
+ jalview.bin.JalviewLite applet;\r
+\r
public AlignViewport(AlignmentI al, JalviewLite applet)\r
{\r
+ this.applet = applet;\r
setAlignment(al);\r
this.startRes = 0;\r
this.endRes = al.getWidth() - 1;\r
return increment;\r
}\r
\r
+ public void setHiddenColumns(ColumnSelection colsel)\r
+ {\r
+ this.colSel = colsel;\r
+ if(colSel.getHiddenColumns()!=null)\r
+ hasHiddenColumns = true;\r
+ }\r
+\r
public ColumnSelection getColumnSelection()\r
{\r
return colSel;\r
{\r
return ignoreGapsInConsensusCalculation;\r
}\r
+ public void hideSelectedColumns()\r
+ {\r
+ if (colSel.size() < 1)\r
+ return;\r
+\r
+ colSel.hideSelectedColumns();\r
+ setSelectionGroup(null);\r
+\r
+ hasHiddenColumns = true;\r
+ }\r
+\r
+\r
+ public void hideColumns(int start, int end)\r
+ {\r
+ if(start==end)\r
+ colSel.hideColumns(start);\r
+ else\r
+ colSel.hideColumns(start, end);\r
+ setSelectionGroup(null);\r
+ hasHiddenColumns = true;\r
+ }\r
+\r
+ public void hideSequence(SequenceI seq)\r
+ {\r
+ if(seq!=null)\r
+ {\r
+ alignment.getHiddenSequences().hideSequence(seq);\r
+ hasHiddenRows = true;\r
+ }\r
+ }\r
+\r
+ public void showSequence(int index)\r
+ {\r
+ alignment.getHiddenSequences().showSequence(index);\r
+\r
+ if(alignment.getHiddenSequences().getSize()<1)\r
+ hasHiddenRows = false;\r
+ }\r
+\r
+ public void showColumn(int col)\r
+ {\r
+ colSel.revealHiddenColumns(col);\r
+ if(colSel.getHiddenColumns()==null)\r
+ hasHiddenColumns = false;\r
+ }\r
+\r
+ public void showAllHiddenColumns()\r
+ {\r
+ colSel.revealAllHiddenColumns();\r
+ hasHiddenColumns = false;\r
+ }\r
+\r
+ public void showAllHiddenSeqs()\r
+ {\r
+ if(alignment.getHiddenSequences().getSize()>0)\r
+ {\r
+ alignment.getHiddenSequences().showAll();\r
+ hasHiddenRows = false;\r
+ }\r
+ }\r
+\r
+ public int adjustForHiddenSeqs(int alignmentIndex)\r
+ {\r
+ return alignment.getHiddenSequences().adjustForHiddenSeqs(alignmentIndex);\r
+ }\r
+\r
+ /**\r
+ * This method returns the a new SequenceI [] with\r
+ * the selection sequence and start and end points adjusted\r
+ * @return String[]\r
+ */\r
+ public SequenceI[] getSelectionAsNewSequence()\r
+ {\r
+ SequenceI[] sequences;\r
+\r
+ if (selectionGroup == null)\r
+ sequences = alignment.getSequencesArray();\r
+ else\r
+ sequences = selectionGroup.getSelectionAsNewSequences(alignment);\r
+\r
+ return sequences;\r
+ }\r
+\r
+ /**\r
+ * This method returns the visible alignment as text, as\r
+ * seen on the GUI, ie if columns are hidden they will not\r
+ * be returned in the result.\r
+ * Use this for calculating trees, PCA, redundancy etc on views\r
+ * which contain hidden columns.\r
+ * @return String[]\r
+ */\r
+ public jalview.datamodel.CigarArray getViewAsCigars(boolean selectedRegionOnly)\r
+ {\r
+ CigarArray selection=null;\r
+ SequenceI [] seqs= null;\r
+ int i, iSize;\r
+ int start = 0, end = 0;\r
+ if(selectedRegionOnly && selectionGroup!=null)\r
+ {\r
+ iSize = selectionGroup.getSize(false);\r
+ seqs = selectionGroup.getSequencesInOrder(alignment);\r
+ start = selectionGroup.getStartRes();\r
+ end = selectionGroup.getEndRes(); // inclusive for start and end in SeqCigar constructor\r
+ }\r
+ else\r
+ {\r
+ iSize = alignment.getHeight();\r
+ seqs = alignment.getSequencesArray();\r
+ end = alignment.getWidth()-1;\r
+ }\r
+ SeqCigar[] selseqs = new SeqCigar[iSize];\r
+ for(i=0; i<iSize; i++)\r
+ {\r
+ selseqs[i] = new SeqCigar(seqs[i], start, end);\r
+ }\r
+ selection=new CigarArray(selseqs);\r
+ // now construct the CigarArray operations\r
+ if (hasHiddenColumns) {\r
+ Vector regions = colSel.getHiddenColumns();\r
+ int [] region;\r
+ int hideStart, hideEnd;\r
+ int last=start;\r
+ for (int j = 0; last<end & j < regions.size(); j++)\r
+ {\r
+ region = (int[]) regions.elementAt(j);\r
+ hideStart = region[0];\r
+ hideEnd = region[1];\r
+ // edit hidden regions to selection range\r
+ if(hideStart<last) {\r
+ if (hideEnd > last)\r
+ {\r
+ hideStart = last;\r
+ } else\r
+ continue;\r
+ }\r
+\r
+ if (hideStart>end)\r
+ break;\r
+\r
+ if (hideEnd>end)\r
+ hideEnd=end;\r
+\r
+ if (hideStart>hideEnd)\r
+ break;\r
+ /**\r
+ * form operations...\r
+ */\r
+ if (last<hideStart)\r
+ selection.addOperation(CigarArray.M, hideStart-last);\r
+ selection.addOperation(CigarArray.D, 1+hideEnd-hideStart);\r
+ last = hideEnd+1;\r
+ }\r
+ // Final match if necessary.\r
+ if (last<end)\r
+ selection.addOperation(CigarArray.M, end-last);\r
+ } else {\r
+ selection.addOperation(CigarArray.M, end-start);\r
+ }\r
+ return selection;\r
+ }\r
+ /**\r
+ * return a compact representation of the current alignment selection to\r
+ * pass to an analysis function\r
+ * @param selectedOnly boolean true to just return the selected view\r
+ * @return AlignmentView\r
+ */\r
+ jalview.datamodel.AlignmentView getAlignmentView(boolean selectedOnly) {\r
+ // JBPNote:\r
+ // this is here because the AlignmentView constructor modifies the CigarArray\r
+ // object. Refactoring of Cigar and alignment view representation should\r
+ // be done to remove redundancy.\r
+ CigarArray aligview = getViewAsCigars(selectedOnly);\r
+ if (aligview!=null)\r
+ return new AlignmentView(aligview);\r
+ return null;\r
+ }\r
+ /**\r
+ * This method returns the visible alignment as text, as\r
+ * seen on the GUI, ie if columns are hidden they will not\r
+ * be returned in the result.\r
+ * Use this for calculating trees, PCA, redundancy etc on views\r
+ * which contain hidden columns.\r
+ * @return String[]\r
+ */\r
+ public String [] getViewAsString(boolean selectedRegionOnly)\r
+ {\r
+ String [] selection = null;\r
+ SequenceI [] seqs= null;\r
+ int i, iSize;\r
+ int start = 0, end = 0;\r
+ if(selectedRegionOnly && selectionGroup!=null)\r
+ {\r
+ iSize = selectionGroup.getSize(false);\r
+ seqs = selectionGroup.getSequencesInOrder(alignment);\r
+ start = selectionGroup.getStartRes();\r
+ end = selectionGroup.getEndRes()+1;\r
+ }\r
+ else\r
+ {\r
+ iSize = alignment.getHeight();\r
+ seqs = alignment.getSequencesArray();\r
+ end = alignment.getWidth();\r
+ }\r
+\r
+ selection = new String[iSize];\r
+\r
+\r
+ for(i=0; i<iSize; i++)\r
+ {\r
+ if (hasHiddenColumns)\r
+ {\r
+ StringBuffer visibleSeq = new StringBuffer();\r
+ Vector regions = colSel.getHiddenColumns();\r
+\r
+ int blockStart = start, blockEnd=end;\r
+ int [] region;\r
+ int hideStart, hideEnd;\r
+\r
+ for (int j = 0; j < regions.size(); j++)\r
+ {\r
+ region = (int[]) regions.elementAt(j);\r
+ hideStart = region[0];\r
+ hideEnd = region[1];\r
+\r
+ if(hideStart < start)\r
+ {\r
+ continue;\r
+ }\r
+\r
+ blockStart = Math.min(blockStart, hideEnd+1);\r
+ blockEnd = Math.min(blockEnd, hideStart);\r
+\r
+ if(blockStart>blockEnd)\r
+ {\r
+ break;\r
+ }\r
+\r
+\r
+ visibleSeq.append(seqs[i].getSequence(blockStart, blockEnd));\r
+\r
+ blockStart = hideEnd+1;\r
+ blockEnd = end;\r
+ }\r
+\r
+ if(end>blockStart)\r
+ visibleSeq.append(seqs[i].getSequence(blockStart, end));\r
+\r
+ selection[i] = visibleSeq.toString();\r
+ }\r
+ else\r
+ {\r
+ selection[i] = seqs[i].getSequence(start, end);\r
+ }\r
+ }\r
+\r
+ return selection;\r
+ }\r
+\r
+ public boolean getShowHiddenMarkers()\r
+ {\r
+ return showHiddenMarkers;\r
+ }\r
+\r
+ public void setShowHiddenMarkers(boolean show)\r
+ {\r
+ showHiddenMarkers = show;\r
+ }\r
\r
\r
}\r
\r
public void setScrollValues(int x, int y)\r
{\r
- av.setStartRes(x);\r
- av.setStartSeq(y);\r
- av.setEndRes(x + seqPanel.seqCanvas.getSize().width / av.getCharWidth() - 1);\r
+ int width = av.alignment.getWidth();\r
+ int height = av.alignment.getHeight();\r
+\r
+ if(av.hasHiddenColumns)\r
+ width = av.getColumnSelection().findColumnPosition(width);\r
+\r
+ av.setEndRes( (x + (seqPanel.seqCanvas.getSize().width / av.charWidth)) -1);\r
\r
hextent = seqPanel.seqCanvas.getSize().width / av.charWidth;\r
vextent = seqPanel.seqCanvas.getSize().height / av.charHeight;\r
\r
- if (hextent > av.alignment.getWidth())\r
+ if (hextent > width)\r
{\r
- hextent = av.alignment.getWidth();\r
+ hextent = width;\r
}\r
- if (vextent > av.alignment.getHeight())\r
+\r
+ if (vextent > height)\r
{\r
- vextent = av.alignment.getHeight();\r
+ vextent = height;\r
}\r
\r
- if (hextent + x > av.getAlignment().getWidth())\r
+ if ( (hextent + x) > width)\r
{\r
- x = av.getAlignment().getWidth() - hextent;\r
+ x = width - hextent;\r
}\r
\r
- if (vextent + y > av.getAlignment().getHeight())\r
+ if ( (vextent + y) > height)\r
{\r
- y = av.getAlignment().getHeight() - vextent;\r
+ y = height - vextent;\r
}\r
\r
if (y < 0)\r
\r
if(overviewPanel!=null)\r
overviewPanel.setBoxPosition();\r
+\r
}\r
\r
public void adjustmentValueChanged(AdjustmentEvent evt)\r
\r
if (av.getWrapAlignment())\r
{\r
- int max = av.alignment.getWidth() /\r
- seqPanel.seqCanvas.\r
- getWrappedCanvasWidth(seqPanel.seqCanvas.getSize().width) +1;\r
+ int maxwidth = av.alignment.getWidth();\r
+\r
+ if (av.hasHiddenColumns)\r
+ maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;\r
+\r
+ int max = maxwidth /\r
+ seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel.seqCanvas.getSize().width) +\r
+ 1;\r
+\r
vscroll.setMaximum(max);\r
vscroll.setUnitIncrement(1);\r
vscroll.setVisibleAmount(1);\r
}\r
\r
int res = evt.getX() / av.getCharWidth() + av.getStartRes();\r
+\r
+ if(av.hasHiddenColumns)\r
+ res = av.getColumnSelection().adjustForHiddenColumns(res);\r
+\r
if (row > -1 && res < aa[row].annotations.length && aa[row].annotations[res] != null)\r
{\r
StringBuffer text = new StringBuffer("Sequence position " + (res + 1) +\r
public void paint(Graphics g)\r
{\r
\r
-\r
imgWidth = (av.endRes - av.startRes + 1) * av.charWidth;\r
\r
if (image == null || imgWidth != image.getWidth(this))\r
\r
int x = 0;\r
int y = 0;\r
+ int column=0;\r
char lastSS;\r
int lastSSX;\r
int iconOffset = av.charHeight / 2;\r
iconOffset = 0;\r
}\r
\r
- int column = startRes;\r
- while(column < endRes)\r
+ x = 0;\r
+ while(x < endRes-startRes)\r
{\r
- if ((row.annotations.length <= column) ||\r
- (row.annotations[column] == null))\r
+ if (av.hasHiddenColumns)\r
+ {\r
+ column = av.getColumnSelection().adjustForHiddenColumns(startRes+x);\r
+ if (column > row.annotations.length-1)\r
+ {\r
+ break;\r
+ }\r
+ }\r
+ else\r
+ column = startRes+x;\r
+\r
+ if ( (row.annotations.length <= column) ||\r
+ (row.annotations[column] == null))\r
{\r
- validRes = false;\r
+ validRes = false;\r
}\r
else\r
{\r
- validRes = true;\r
+ validRes = true;\r
}\r
\r
- x = (column - startRes) * av.charWidth;\r
-\r
\r
if (av.validCharWidth && validRes &&\r
(row.annotations[column].displayCharacter.length() > 0))\r
\r
if (column == 0 || row.graph>0)\r
{\r
- g.drawString(row.annotations[column].displayCharacter, x+charOffset,\r
+ g.drawString(row.annotations[column].displayCharacter,\r
+ (x*av.charWidth)+charOffset,\r
y + iconOffset + 3);\r
}\r
else if (\r
(row.annotations[column].displayCharacter.length() <2 &&\r
row.annotations[column].secondaryStructure==' ')))\r
{\r
- g.drawString(row.annotations[column].displayCharacter, x+charOffset,\r
+ g.drawString(row.annotations[column].displayCharacter,\r
+ (x*av.charWidth)+charOffset,\r
y + iconOffset + 3);\r
}\r
}\r
//Off by 1 offset when drawing rects and ovals\r
//to offscreen image on the MAC\r
g.fillRoundRect(lastSSX, y + 4 + iconOffset,\r
- x - lastSSX, 7, 8, 8);\r
+ (x*av.charWidth) - lastSSX, 7, 8, 8);\r
break;\r
}\r
\r
int sCol = (lastSSX / av.charWidth) + startRes;\r
int x1 = lastSSX;\r
- int x2 = x;\r
+ int x2 = (x*av.charWidth);\r
\r
if(sCol==0 ||\r
row.annotations[sCol-1]==null ||\r
if(row.annotations[column]==null ||\r
row.annotations[column].secondaryStructure!='H')\r
{\r
- g.fillArc(x-av.charWidth, y+4+iconOffset, av.charWidth, 8, 270,180);\r
+ g.fillArc((x*av.charWidth)-av.charWidth,\r
+ y+4+iconOffset, av.charWidth, 8, 270,180);\r
x2 -= av.charWidth/2;\r
}\r
\r
case 'E':\r
g.setColor(SHEET_COLOUR);\r
g.fillRect(lastSSX, y + 4 + iconOffset,\r
- x - lastSSX - 4, 7);\r
- g.fillPolygon(new int[] { x - 4, x - 4, x },\r
+ (x*av.charWidth) - lastSSX - 4, 7);\r
+ g.fillPolygon(new int[] { (x*av.charWidth) - 4,\r
+ (x*av.charWidth) - 4,\r
+ (x*av.charWidth) },\r
new int[]\r
{\r
y + iconOffset, y + 14 + iconOffset,\r
default:\r
g.setColor(Color.gray);\r
g.fillRect(lastSSX, y + 6 + iconOffset,\r
- x - lastSSX, 2);\r
+ (x*av.charWidth) - lastSSX, 2);\r
\r
break;\r
}\r
lastSS = ' ';\r
}\r
\r
- lastSSX = x;\r
+ lastSSX = (x*av.charWidth);\r
}\r
}\r
\r
\r
column++;\r
+ x++;\r
}\r
\r
if(column>=row.annotations.length)\r
column = row.annotations.length-1;\r
\r
- x += av.charWidth;\r
+ // x ++;\r
\r
if (row.hasIcons)\r
{\r
- switch (lastSS)\r
- {\r
+ switch (lastSS)\r
+ {\r
case 'H':\r
g.setColor(HELIX_COLOUR);\r
if (MAC)\r
//Off by 1 offset when drawing rects and ovals\r
//to offscreen image on the MAC\r
g.fillRoundRect(lastSSX, y + 4 + iconOffset,\r
- x - lastSSX, 7, 8, 8);\r
+ (x*av.charWidth) - lastSSX, 7, 8, 8);\r
break;\r
}\r
\r
-\r
int sCol = (lastSSX / av.charWidth) + startRes;\r
int x1 = lastSSX;\r
- int x2 = x;\r
-\r
- if(sCol==0 ||\r
- row.annotations[sCol-1]==null ||\r
- row.annotations[sCol-1].secondaryStructure!='H')\r
- {\r
- g.fillArc(lastSSX, y+4+iconOffset, av.charWidth, 8, 90,180) ;\r
- x1 += av.charWidth/2;\r
- }\r
-\r
- if(row.annotations[column]==null ||\r
- row.annotations[column].secondaryStructure!='H')\r
+ int x2 = (x*av.charWidth);\r
+\r
+ if (sCol == 0 ||\r
+ row.annotations[sCol - 1] == null ||\r
+ row.annotations[sCol - 1].secondaryStructure != 'H')\r
{\r
- g.fillArc(x-av.charWidth, y+4+iconOffset, av.charWidth, 8, 270,180);\r
- x2 -= av.charWidth/2;\r
+ g.fillArc(lastSSX, y + 4 + iconOffset, av.charWidth, 8, 90, 180);\r
+ x1 += av.charWidth / 2;\r
}\r
\r
- g.fillRect(x1, y+4+iconOffset, x2-x1, 8);\r
+ if (row.annotations[column] == null ||\r
+ row.annotations[column].secondaryStructure != 'H')\r
+ {\r
+ g.fillArc((x*av.charWidth) - av.charWidth,\r
+ y + 4 + iconOffset, av.charWidth, 8, 270,\r
+ 180);\r
+ x2 -= av.charWidth / 2;\r
+ }\r
\r
- break;\r
+ g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 8);\r
\r
- case 'E':\r
- g.setColor(SHEET_COLOUR);\r
+ break;\r
\r
- if (row.annotations[endRes] ==null\r
- || row.annotations[endRes].secondaryStructure != 'E')\r
- {\r
- g.fillRect(lastSSX, y + 4 + iconOffset,\r
- x - lastSSX - 4, 7);\r
- g.fillPolygon(new int[]\r
- {x - 4, x - 4, x},\r
- new int[]\r
- {\r
- y + iconOffset, y + 14 + iconOffset,\r
- y + 7 + iconOffset\r
- }, 3);\r
- }\r
- else\r
- g.fillRect(lastSSX, y + 4 + iconOffset,\r
- x - lastSSX, 7);\r
-\r
- break;\r
+ case 'E':\r
+ g.setColor(SHEET_COLOUR);\r
\r
+ if (row.annotations[endRes] == null\r
+ || row.annotations[endRes].secondaryStructure != 'E')\r
+ {\r
+ g.fillRect(lastSSX, y + 4 + iconOffset,\r
+ (x*av.charWidth) - lastSSX - 4, 7);\r
+ g.fillPolygon(new int[]\r
+ {(x*av.charWidth) - 4,\r
+ (x*av.charWidth) - 4,\r
+ (x*av.charWidth)},\r
+ new int[]\r
+ {\r
+ y + iconOffset, y + 14 + iconOffset,\r
+ y + 7 + iconOffset\r
+ }, 3);\r
+ }\r
+ else\r
+ {\r
+ g.fillRect(lastSSX, y + 4 + iconOffset,\r
+ (x+1) * av.charWidth - lastSSX, 7);\r
+ }\r
+ break;\r
\r
default:\r
- g.setColor(Color.gray);\r
- g.fillRect(lastSSX, y + 6 + iconOffset, x - lastSSX, 2);\r
+ g.setColor(Color.gray);\r
+ g.fillRect(lastSSX, y + 6 + iconOffset,\r
+ (x*av.charWidth) - lastSSX, 2);\r
\r
- break;\r
- }\r
+ break;\r
+ }\r
}\r
\r
if (row.graph>0)\r
g.setColor(Color.gray);\r
g.drawLine(x-av.charWidth,y2,(eRes-sRes)*av.charWidth,y2);\r
\r
+ eRes = Math.min(eRes, aa.annotations.length);\r
+\r
+ int column;\r
+ int aaMax = aa.annotations.length-1;\r
\r
- for (int j = sRes; j < eRes; j++)\r
+ while( x < eRes - sRes )\r
{\r
- if(aa.annotations[j]==null || aa.annotations[j-1]==null)\r
+ column = sRes + x;\r
+ if(av.hasHiddenColumns)\r
+ {\r
+ column = av.getColumnSelection().adjustForHiddenColumns(column);\r
+ }\r
+\r
+ if (column > aaMax)\r
+ {\r
+ break;\r
+ }\r
+\r
+ if(aa.annotations[column]==null || aa.annotations[column-1]==null)\r
{\r
- x+=av.charWidth;\r
+ x++;\r
continue;\r
}\r
- g.setColor(aa.annotations[j].colour);\r
- y1 = y - (int) (((aa.annotations[j-1].value-min) / range) * graphHeight);\r
- y2 = y - (int) (((aa.annotations[j].value-min) / range) * graphHeight);\r
- g.drawLine(x-av.charWidth/2, y1, x+av.charWidth/2, y2);\r
- x += av.charWidth;\r
- }\r
\r
+ g.setColor(aa.annotations[column].colour);\r
+ y1 = y - (int) (((aa.annotations[column-1].value-min) / range) * graphHeight);\r
+ y2 = y - (int) (((aa.annotations[column].value-min) / range) * graphHeight);\r
+\r
+ g.drawLine(x*av.charWidth-av.charWidth/2, y1, x*av.charWidth+av.charWidth/2, y2);\r
+ x ++;\r
+ }\r
\r
if(aa.threshold!=null)\r
{\r
g.setColor(aa.threshold.colour);\r
- y2 = (int)(y - ((aa.threshold.value-min) / range)*aa.graphHeight);\r
- g.drawLine(0,y2,(eRes-sRes)*av.charWidth,y2);\r
- }\r
\r
+ y2 = (int)(y - ((aa.threshold.value-min) / range)*graphHeight);\r
+ g.drawLine(0,y2,(eRes-sRes)*av.charWidth,y2);\r
+ }\r
}\r
\r
public void drawBarGraph(Graphics g, AlignmentAnnotation aa,\r
if(sRes>aa.annotations.length)\r
return;\r
\r
-\r
eRes = Math.min(eRes, aa.annotations.length);\r
\r
- int x=0, y1, y2;\r
+ int x=0, y1=y, y2=y;\r
\r
float range = max - min;\r
\r
- y1 = y2 = y;\r
-\r
if(min<0)\r
- y2 = y -(int)( (0-min / (range))*aa.graphHeight);\r
+ y2 = y - (int)((0-min / (range))*aa.graphHeight);\r
\r
g.setColor(Color.gray);\r
\r
g.drawLine(x,y2,(eRes-sRes)*av.charWidth,y2);\r
\r
- for (int j = sRes; j < eRes; j++)\r
+ int column;\r
+ int aaMax = aa.annotations.length-1;\r
+\r
+ while( x < eRes-sRes )\r
{\r
+ column = sRes + x;\r
+ if(av.hasHiddenColumns)\r
+ {\r
+ column = av.getColumnSelection().adjustForHiddenColumns(column);\r
+ }\r
+\r
+ if(column > aaMax)\r
+ {\r
+ break;\r
+ }\r
\r
- if (aa.annotations[j] == null)\r
+ if (aa.annotations[column] == null)\r
{\r
- x += av.charWidth;\r
+ x ++;\r
continue;\r
}\r
\r
- g.setColor(aa.annotations[j].colour);\r
- y1 = y - (int) (((aa.annotations[j].value-min) / (range)) * aa.graphHeight);\r
+ g.setColor(aa.annotations[column].colour);\r
+ y1 = y - (int) (((aa.annotations[column].value-min) / (range)) * aa.graphHeight);\r
\r
if(y1-y2>0)\r
- g.fillRect(x, y2, av.charWidth, y1-y2 );\r
+ g.fillRect(x*av.charWidth, y2, av.charWidth, y1-y2 );\r
else\r
- g.fillRect(x, y1, av.charWidth, y2-y1 );\r
-\r
- x += av.charWidth;\r
- }\r
+ g.fillRect(x*av.charWidth, y1, av.charWidth, y2-y1 );\r
\r
+ x ++ ;\r
\r
+ }\r
if(aa.threshold!=null)\r
{\r
g.setColor(aa.threshold.colour);\r
y2 = (int)(y - ((aa.threshold.value-min) / range)*aa.graphHeight);\r
g.drawLine(0,y2,(eRes-sRes)*av.charWidth,y2);\r
- }\r
-\r
-\r
+ }\r
}\r
\r
// used by overview window\r
}\r
if (sequences != null)\r
{\r
- AlignFrame af = new AlignFrame(new Alignment(sequences), alignFrame.applet,\r
+ AlignFrame af = new AlignFrame(new Alignment(sequences), alignFrame.viewport.applet,\r
"Cut & Paste input - " + format,\r
false);\r
af.statusBar.setText("Successfully pasted alignment file");\r
renderOrder = fr.renderOrder;\r
featureGroups = fr.featureGroups;\r
featureColours = fr.featureColours;\r
+ transparency = fr.transparency;\r
}\r
\r
\r
\r
currentColour = null;\r
\r
- drawSequence(null, lastSequence, lastSequence.findPosition(i), -1,-1, -1, -1);\r
+ drawSequence(null, lastSequence, lastSequence.findPosition(i), -1,-1);\r
\r
if(currentColour==null)\r
return initialCol;\r
\r
currentColour = null;\r
\r
- drawSequence(null, lastSequence, lastSequence.findPosition(column), -1,-1, -1, -1);\r
+ drawSequence(null, lastSequence, lastSequence.findPosition(column), -1,-1);\r
\r
if(currentColour==null)\r
return initialCol;\r
int sfSize, sfindex, spos, epos;\r
\r
public void drawSequence(Graphics g, SequenceI seq,\r
- int start, int end, int y1, int width, int height)\r
+ int start, int end, int y1)\r
{\r
if ( seq.getSequenceFeatures() == null\r
|| seq.getSequenceFeatures().length==0)\r
seq.findIndex(sequenceFeatures[sfindex].begin) - 1,\r
new Color( ( (Integer) av.featuresDisplayed.get(\r
sequenceFeatures[sfindex].type)).intValue()),\r
- start, end, y1, width, height);\r
+ start, end, y1);\r
renderFeature(g, seq,\r
seq.findIndex(sequenceFeatures[sfindex].end) - 1,\r
seq.findIndex(sequenceFeatures[sfindex].end) - 1,\r
new Color( ( (Integer) av.featuresDisplayed.get(\r
sequenceFeatures[sfindex].type)).intValue()),\r
- start, end, y1, width, height);\r
+ start, end, y1);\r
\r
}\r
else\r
seq.findIndex(sequenceFeatures[sfindex].begin) - 1,\r
seq.findIndex(sequenceFeatures[sfindex].end) - 1,\r
getColour(sequenceFeatures[sfindex].type),\r
- start, end, y1, width, height);\r
+ start, end, y1);\r
\r
}\r
}\r
char s;\r
int i;\r
void renderFeature(Graphics g, SequenceI seq,\r
- int fstart, int fend, Color featureColour, int start, int end, int y1, int width, int height)\r
+ int fstart, int fend, Color featureColour, int start, int end, int y1)\r
{\r
\r
if (((fstart <= end) && (fend >= start)))\r
\r
g.setColor(featureColour);\r
\r
- g.fillRect( (i - start) * width, y1, width, height);\r
+ g.fillRect( (i - start) * av.charWidth, y1, av.charWidth, av.charHeight);\r
\r
if(!av.validCharWidth)\r
continue;\r
\r
g.setColor(Color.white);\r
- charOffset = (width - fm.charWidth(s)) / 2;\r
+ charOffset = (av.charWidth - fm.charWidth(s)) / 2;\r
g.drawString(String.valueOf(s),\r
- charOffset + (width * (i - start)),\r
- (y1 + height) - height / 5); //pady = height / 5;\r
+ charOffset + (av.charWidth * (i - start)),\r
+ (y1 + av.charHeight) - av.charHeight / 5); //pady = height / 5;\r
\r
}\r
}\r
{\r
void setTransparency(Graphics g, float value)\r
{\r
- Graphics2D g2 = (Graphics2D) g;\r
- g2.setComposite(\r
- AlphaComposite.getInstance(\r
- AlphaComposite.SRC_OVER, value));\r
+ //Graphics2D g2 = (Graphics2D) g;\r
+ // g2.setComposite(\r
+ // AlphaComposite.getInstance(\r
+ // AlphaComposite.SRC_OVER, value));\r
}\r
}\r
\r
((i - starty) * charHeight) + ypos +\r
charHeight - (charHeight / 5));\r
\r
+ if (av.hasHiddenRows && av.showHiddenMarkers)\r
+ drawMarker(i, starty, ypos);\r
+\r
}\r
\r
public void fastPaint(int vertical)\r
gg.setFont(italic);\r
\r
gg.fillRect(0, 0, getSize().width, getSize().height);\r
- drawIds(av.getStartSeq(), av.endSeq);\r
+ drawIds(av.startSeq, av.endSeq);\r
g.drawImage(image, 0, 0, this);\r
}\r
\r
void drawIds(int starty, int endy)\r
{\r
+ Font italic = new Font(av.getFont().getName(), Font.ITALIC,\r
+ av.getFont().getSize());\r
+\r
+ gg.setFont(italic);\r
+\r
Color currentColor = Color.white;\r
Color currentTextColor = Color.black;\r
- Font italic = new Font(av.getFont().getName(), Font.ITALIC,\r
- av.getFont().getSize());\r
\r
if (av.getWrapAlignment())\r
{\r
+ int maxwidth = av.alignment.getWidth();\r
+ int alheight = av.alignment.getHeight();\r
+\r
+ if (av.hasHiddenColumns)\r
+ maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;\r
+\r
int annotationHeight = 0;\r
AnnotationLabels labels = null;\r
\r
- if(av.showAnnotation)\r
+ if (av.showAnnotation)\r
{\r
AnnotationPanel ap = new AnnotationPanel(av);\r
annotationHeight = ap.adjustPanelHeight();\r
if (av.scaleAboveWrapped)\r
hgap += av.charHeight;\r
\r
- int cHeight = av.getAlignment().getHeight() * av.charHeight\r
+ int cHeight = alheight * av.charHeight\r
+ hgap\r
+ annotationHeight;\r
\r
- int rowSize = av.getEndRes() - av.getStartRes();\r
+ int rowSize = av.getEndRes() - av.getStartRes();\r
\r
- // Draw the rest of the panels\r
- for (int ypos = hgap, row = av.startRes;\r
- (ypos <= getSize().height) && (row < av.alignment.getWidth());\r
- ypos += cHeight, row += rowSize)\r
+ // Draw the rest of the panels\r
+ for (int ypos = hgap, row = av.startRes;\r
+ (ypos <= getSize().height) && (row < maxwidth);\r
+ ypos += cHeight, row += rowSize)\r
+ {\r
+ for (int i = starty; i < alheight; i++)\r
{\r
- for (int i = starty; i < av.alignment.getHeight(); i++)\r
- {\r
- SequenceI s = av.alignment.getSequenceAt(i);\r
- gg.setFont(italic);\r
- drawIdString(gg, s, i, 0, ypos);\r
- }\r
-\r
- if(labels!=null)\r
- {\r
- gg.translate(0, ypos+(av.getAlignment().getHeight() * av.charHeight));\r
- labels.drawComponent(gg, getSize().width);\r
- gg.translate(0, -ypos-(av.getAlignment().getHeight() * av.charHeight));\r
- }\r
+ if (av.hasHiddenRows)\r
+ {\r
+ setHiddenFont(i);\r
+ }\r
+ else\r
+ gg.setFont(italic);\r
+\r
+ SequenceI s = av.alignment.getSequenceAt(i);\r
+ drawIdString(gg, s, i, 0, ypos);\r
}\r
\r
+ if (labels != null)\r
+ {\r
+ gg.translate(0, ypos + (alheight * av.charHeight));\r
+ labels.drawComponent(gg, getSize().width);\r
+ gg.translate(0, -ypos - (alheight * av.charHeight));\r
+ }\r
+\r
+ }\r
}\r
else\r
{\r
+ //Now draw the id strings\r
\r
//Now draw the id strings\r
for (int i = starty; i < endy; i++)\r
{\r
- // Selected sequence colours\r
+ if (av.hasHiddenRows)\r
+ {\r
+ setHiddenFont(i);\r
+ }\r
\r
- if (searchResults != null &&\r
+ // Selected sequence colours\r
+ if ( (searchResults != null) &&\r
searchResults.contains(av.alignment.getSequenceAt(i)))\r
{\r
- gg.setColor(Color.black);\r
currentColor = Color.black;\r
currentTextColor = Color.white;\r
}\r
- else if (av.getSelectionGroup() != null\r
- &&\r
- av.getSelectionGroup().getSequences(false).contains(av.alignment.\r
- getSequenceAt(i)))\r
+ else if ( (av.getSelectionGroup() != null) &&\r
+ av.getSelectionGroup().getSequences(false).contains(\r
+ av.alignment.getSequenceAt(i)))\r
{\r
currentColor = Color.lightGray;\r
currentTextColor = Color.black;\r
\r
gg.setColor(currentColor);\r
\r
- gg.fillRect(0,\r
- ((i - starty) * av.charHeight),\r
- getSize().width,\r
+ gg.fillRect(0, (i - starty) * av.charHeight, getSize().width,\r
av.charHeight);\r
\r
gg.setColor(currentTextColor);\r
\r
- gg.drawString(av.alignment.getSequenceAt(i)\r
- .getDisplayId(av.getShowJVSuffix()), 0,\r
- ((i - starty) * av.charHeight) +\r
- av.charHeight - (av.charHeight / 5));\r
- }\r
+ String string = av.alignment.getSequenceAt(i).getDisplayId(av.\r
+ getShowJVSuffix());\r
\r
- // add a border\r
- gg.setColor(Color.white);\r
- gg.fillRect(getSize().width - 4, 0, 4, getSize().height);\r
- }\r
+ gg.drawString(string, 0,\r
+ ( ( (i - starty) * av.charHeight) + av.charHeight) -\r
+ (av.charHeight / 5));\r
\r
+ if (av.hasHiddenRows && av.showHiddenMarkers)\r
+ drawMarker(i, starty, 0);\r
+ }\r
+ }\r
}\r
\r
public void setHighlighted(java.util.Vector found)\r
searchResults = found;\r
repaint();\r
}\r
+\r
+ void drawMarker(int i, int starty, int yoffset)\r
+ {\r
+ int hiddenIndex = av.adjustForHiddenSeqs(i);\r
+ int lastIndex = av.adjustForHiddenSeqs(i - 1);\r
+ int nextIndex = av.adjustForHiddenSeqs(i + 1);\r
+\r
+ boolean below = (hiddenIndex > lastIndex + 1);\r
+ boolean above = (nextIndex>hiddenIndex+1);\r
+\r
+ gg.setColor(Color.blue);\r
+ if(below)\r
+ {\r
+ gg.fillPolygon(new int[]\r
+ {getSize().width- av.charHeight,\r
+ getSize().width- av.charHeight,\r
+ getSize().width},\r
+ new int[]\r
+ {\r
+ (i - starty) * av.charHeight +yoffset,\r
+ (i - starty) * av.charHeight +yoffset+ av.charHeight / 4,\r
+ (i - starty) * av.charHeight+yoffset\r
+ }, 3);\r
+ }\r
+ if(above)\r
+ {\r
+ gg.fillPolygon(new int[]\r
+ {getSize().width- av.charHeight,\r
+ getSize().width - av.charHeight,\r
+ getSize().width },\r
+ new int[]\r
+ {\r
+ (i - starty+1) * av.charHeight +yoffset,\r
+ (i - starty+1) * av.charHeight +yoffset- av.charHeight / 4,\r
+ (i - starty+1) * av.charHeight +yoffset\r
+ }, 3);\r
+\r
+ }\r
+ }\r
+\r
+ void setHiddenFont(int i)\r
+ {\r
+ /* System.out.println(i+" "+av.alignment.getHeight());\r
+ if (av.alignment.getSequenceAt(i).getHiddenSequences() != null)\r
+ gg.setFont(new Font(av.getFont().getName(), Font.BOLD,\r
+ av.getFont().getSize()));\r
+ else\r
+ gg.setFont(new Font(av.getFont().getName(), Font.ITALIC,\r
+ av.getFont().getSize()));*/\r
+ }\r
}\r
idCanvas.addMouseMotionListener(this);\r
\r
String label, url;\r
- if(parent.alignFrame.applet!=null)\r
+ if(av.applet!=null)\r
{\r
for (int i = 1; i < 10; i++)\r
{\r
- label = parent.alignFrame.applet.getParameter("linkLabel_" + i);\r
- url = parent.alignFrame.applet.getParameter("linkURL_" + i);\r
+ label = av.applet.getParameter("linkLabel_" + i);\r
+ url = av.applet.getParameter("linkURL_" + i);\r
\r
if (label != null && url != null)\r
links.addElement(label + "|" + url);\r
\r
sr = new SequenceRenderer(av);\r
sr.graphics = nullFrame.getGraphics();\r
- sr.renderGaps( false );\r
+ sr.renderGaps = false;\r
sr.forOverview = true;\r
fr = new FeatureRenderer(av);\r
fr.overview = true;\r
{\r
boxX = evt.getX();\r
boxY = evt.getY();\r
-\r
checkValid();\r
- repaint();\r
}\r
\r
public void mouseReleased(MouseEvent evt)\r
boxX = evt.getX();\r
boxY = evt.getY();\r
checkValid();\r
- ap.setScrollValues( (int) (boxX / scalew / av.getCharWidth()),\r
- (int) (boxY / scaleh / av.getCharHeight()));\r
}\r
\r
public void mouseDragged(MouseEvent evt)\r
boxX = evt.getX();\r
boxY = evt.getY();\r
checkValid();\r
- ap.setScrollValues( (int) (boxX / scalew / av.getCharWidth()),\r
- (int) (boxY / scaleh / av.getCharHeight()));\r
-\r
- repaint();\r
ap.repaint();\r
}\r
\r
{\r
if (boxY < 0)\r
{\r
- boxY = 0;\r
+ boxY = 0;\r
}\r
\r
- if (boxY > sequencesHeight - boxHeight)\r
+ if (boxY > (sequencesHeight - boxHeight))\r
{\r
- boxY = sequencesHeight - boxHeight + 1;\r
+ boxY = sequencesHeight - boxHeight + 1;\r
}\r
\r
if (boxX < 0)\r
{\r
- boxX = 0;\r
+ boxX = 0;\r
}\r
\r
- if (boxX > width - boxWidth)\r
+ if (boxX > (width - boxWidth))\r
{\r
+ if(av.hasHiddenColumns)\r
+ {\r
+ //Try smallest possible box\r
+ boxWidth = (int) ( (av.endRes - av.startRes + 1) *\r
+ av.getCharWidth() * scalew);\r
+ }\r
boxX = width - boxWidth;\r
}\r
+\r
+ int col = (int) (boxX / scalew / av.getCharWidth());\r
+ int row = (int) (boxY / scaleh / av.getCharHeight());\r
+\r
+ if (av.hasHiddenColumns)\r
+ {\r
+ if (!av.getColumnSelection().isVisible(col))\r
+ {\r
+ return;\r
+ }\r
+\r
+ col = av.getColumnSelection().findColumnPosition(col);\r
+ }\r
+\r
+ if( av.hasHiddenRows )\r
+ {\r
+ row = av.alignment.getHiddenSequences().findIndexWithoutHiddenSeqs(row);\r
+ }\r
+\r
+ ap.setScrollValues( col, row );\r
+\r
}\r
\r
/**\r
sequencesHeight = getSize().height - graphHeight;\r
}\r
setSize(new Dimension(width, sequencesHeight + graphHeight));\r
- setBoxPosition();\r
\r
Thread thread = new Thread(this);\r
thread.start();\r
- repaint();\r
+ repaint();\r
}\r
\r
// This is set true if the user resizes whilst\r
\r
if (av.showSequenceFeatures)\r
{\r
- fr.renderOrder = ap.seqPanel.seqCanvas.getFeatureRenderer().renderOrder;\r
- fr.featureGroups = ap.seqPanel.seqCanvas.getFeatureRenderer().featureGroups;\r
- fr.featureColours = ap.seqPanel.seqCanvas.getFeatureRenderer().featureColours;\r
- fr.sequenceFeatures = ap.seqPanel.seqCanvas.getFeatureRenderer().sequenceFeatures;\r
+ fr.transferSettings( ap.seqPanel.seqCanvas.getFeatureRenderer() );\r
}\r
\r
if (getSize().width > 0 && getSize().height > 0)\r
float sampleCol = (float) alwidth / (float) width;\r
float sampleRow = (float) alheight / (float) sequencesHeight;\r
\r
- int lastcol=0, lastseq=0;\r
- int xstart=0, ystart=0;\r
+ int lastcol=-1, lastrow=-1;\r
Color color = Color.yellow;\r
- int col, sameRow = 0, sameCol = 0;\r
- jalview.datamodel.SequenceI sequence;\r
-\r
- for (int row = 0; row <= sequencesHeight; row++)\r
+ int row, col, sameRow = 0, sameCol = 0;\r
+ jalview.datamodel.SequenceI seq;\r
+ boolean hiddenRow = false;\r
+ for (row = 0; row < sequencesHeight; row++)\r
{\r
- if((int)(row*sampleRow)==lastseq)\r
+ if((int)(row*sampleRow)==lastrow)\r
{\r
sameRow ++;\r
continue;\r
}\r
\r
- sequence = av.getAlignment().getSequenceAt(lastseq);\r
+ lastrow = (int)(row*sampleRow);\r
\r
- for (col = 0; col < width; col++)\r
+ hiddenRow = false;\r
+ if (av.hasHiddenRows)\r
{\r
- if((int)(col*sampleCol) == lastcol)\r
+ seq = av.alignment.getHiddenSequences().getHiddenSequence(lastrow);\r
+ if (seq == null)\r
{\r
- sameCol ++;\r
- continue;\r
- }\r
-\r
- lastcol = (int)(col*sampleCol);\r
+ int index =\r
+ av.alignment.getHiddenSequences().findIndexWithoutHiddenSeqs(lastrow);\r
\r
- if(sequence.getLength()>lastcol)\r
- {\r
- color = sr.findSequenceColour(sequence, lastcol);\r
-\r
- if (av.showSequenceFeatures)\r
- color = fr.findFeatureColour(color,\r
- sequence,\r
- lastcol);\r
+ seq = av.alignment.getSequenceAt(index);\r
}\r
else\r
- color = color.white;\r
-\r
- mg.setColor(color);\r
- if (sameCol == 1 && sameRow == 1)\r
- mg.drawLine(xstart, ystart, xstart, ystart);\r
- else\r
- mg.fillRect(xstart, ystart, sameCol, sameRow);\r
-\r
- xstart = col;\r
- sameCol = 1;\r
+ {\r
+ hiddenRow = true;\r
+ }\r
}\r
+ else\r
+ seq = av.alignment.getSequenceAt(lastrow);\r
\r
+ if(seq==null)\r
+ {\r
+ System.out.println(lastrow+" null");\r
+ continue;\r
+ }\r
\r
- lastseq = (int)(row*sampleRow);\r
- ystart = row;\r
+ for (col = 0; col < width; col++)\r
+ {\r
+ if ( (int) (col * sampleCol) == lastcol && (int) (row * sampleRow) == lastrow)\r
+ {\r
+ sameCol ++;\r
+ continue;\r
+ }\r
+\r
+ lastcol = (int) (col * sampleCol);\r
+\r
+ if (seq.getLength() > lastcol)\r
+ {\r
+ color = sr.getResidueBoxColour(\r
+ seq, lastcol);\r
+\r
+ if (av.showSequenceFeatures)\r
+ color = fr.findFeatureColour(color, seq, lastcol);\r
+ }\r
+ else\r
+ {\r
+ color = Color.white; //White\r
+ }\r
+\r
+ if (hiddenRow ||\r
+ (av.hasHiddenColumns && !av.getColumnSelection().isVisible(lastcol)))\r
+ {\r
+ color = color.darker().darker();\r
+ }\r
+\r
+ mg.setColor(color);\r
+ if (sameCol == 1 && sameRow == 1)\r
+ mg.drawLine(col, row, col, row);\r
+ else\r
+ mg.fillRect(col, row, col+sameCol, col+sameRow);\r
+\r
+ sameCol = 1;\r
+ }\r
sameRow = 1;\r
}\r
\r
}\r
}\r
}\r
-\r
-\r
-\r
System.gc();\r
\r
resizing = false;\r
resizeAgain = false;\r
updateOverviewImage();\r
}\r
- }\r
+}\r
\r
public void setBoxPosition()\r
{\r
int fullsizeWidth = av.alignment.getWidth() * av.getCharWidth();\r
- int fullsizeHeight = av.alignment.getHeight() * av.getCharHeight();\r
+ int fullsizeHeight = (av.alignment.getHeight()\r
+ + av.alignment.getHiddenSequences().getSize()) *\r
+ av.getCharHeight();\r
+\r
+ int startRes = av.getStartRes();\r
+ int endRes = av.getEndRes();\r
+\r
+ if (av.hasHiddenColumns)\r
+ {\r
+ startRes = av.getColumnSelection().adjustForHiddenColumns(startRes);\r
+ endRes = av.getColumnSelection().adjustForHiddenColumns(endRes);\r
+ }\r
+\r
+ int startSeq = av.startSeq;\r
+ int endSeq = av.endSeq;\r
+\r
+ if (av.hasHiddenRows)\r
+ {\r
+ startSeq =\r
+ av.alignment.getHiddenSequences().adjustForHiddenSeqs(startSeq);\r
+\r
+ endSeq =\r
+ av.alignment.getHiddenSequences().adjustForHiddenSeqs(endSeq);\r
+\r
+ }\r
\r
scalew = (float) width / (float) fullsizeWidth;\r
scaleh = (float) sequencesHeight / (float) fullsizeHeight;\r
\r
- boxX = (int) (av.getStartRes() * av.getCharWidth() * scalew);\r
- boxY = (int) (av.getStartSeq() * av.getCharHeight() * scaleh);\r
- boxWidth = (int) ( (av.getEndRes() - av.getStartRes() + 1) *\r
- av.getCharWidth() * scalew);\r
- boxHeight = (int) (av.getEndSeq() * av.getCharHeight() * scaleh) - boxY;\r
+ boxX = (int) (startRes * av.getCharWidth() * scalew);\r
+ boxY = (int) (startSeq * av.getCharHeight() * scaleh);\r
+\r
+ if (av.hasHiddenColumns)\r
+ boxWidth = (int) ( (endRes - startRes + 1) * av.getCharWidth() * scalew);\r
+ else\r
+ boxWidth = (int) ( (endRes - startRes + 1) * av.getCharWidth() * scalew);\r
+\r
+ boxHeight = (int) ( (endSeq - startSeq) * av.getCharHeight() * scaleh);\r
+\r
repaint();\r
}\r
\r
RotatableCanvas rc;\r
AlignViewport av;\r
SequenceI [] seqs;\r
+ AlignmentView seqstrings;\r
\r
\r
public PCAPanel(AlignViewport av)\r
}\r
\r
this.av = av;\r
- if (av.getSelectionGroup()!=null && av.getSelectionGroup().getSize(false) > 3)\r
+ seqstrings = av.getAlignmentView(av.getSelectionGroup()!=null);\r
+ if(av.getSelectionGroup()==null)\r
{\r
- seqs = new Sequence[av.getSelectionGroup().getSize(false)];\r
- for (int i = 0; i < av.getSelectionGroup().getSize(false); i++)\r
- {\r
- seqs[i] = av.getSelectionGroup().getSequenceAt(i);\r
- }\r
+ seqs = av.alignment.getSequencesArray();\r
}\r
else\r
{\r
- seqs = new Sequence[av.getAlignment().getHeight()];\r
- for (int i = 0; i < av.getAlignment().getHeight(); i++)\r
+ seqs = av.getSelectionGroup().getSequencesInOrder(av.alignment);\r
+ }\r
+ SeqCigar sq[]=seqstrings.getSequences();\r
+ int length = sq[0].getWidth();\r
+\r
+ for (int i = 0; i < seqs.length; i++)\r
+ {\r
+ if (sq[i].getWidth() != length)\r
{\r
- seqs[i] = av.getAlignment().getSequenceAt(i);\r
+ System.out.println("Sequences must be equal length for PCA analysis");\r
+ return;\r
}\r
}\r
\r
+\r
rc = new RotatableCanvas(av);\r
add(rc, BorderLayout.CENTER);\r
\r
*/\r
public void run()\r
{\r
- pca = null;//new PCA(seqs);\r
+ pca = new PCA(seqstrings.getSequenceStrings(' '));\r
pca.run();\r
\r
// Now find the component coordinates\r
\r
public void actionPerformed(ActionEvent evt)\r
{\r
- values_actionPerformed();\r
+ if(evt.getSource()==inputData)\r
+ showOriginalData();\r
+ else\r
+ values_actionPerformed();\r
}\r
\r
public void itemStateChanged(ItemEvent evt)\r
cap.setText(pca.getDetails());\r
}\r
\r
+ void showOriginalData()\r
+ {\r
+ // decide if av alignment is sufficiently different to original data to warrant a new window to be created\r
+ // create new alignmnt window with hidden regions (unhiding hidden regions yields unaligned seqs)\r
+ // or create a selection box around columns in alignment view\r
+ // test Alignment(SeqCigar[])\r
+ Object[] alAndColsel = seqstrings.getAlignmentAndColumnSelection(av.\r
+ getGapCharacter());\r
+\r
+\r
+ if (alAndColsel != null && alAndColsel[0]!=null)\r
+ {\r
+ Alignment al = new Alignment( (SequenceI[]) alAndColsel[0]);\r
+ AlignFrame af = new AlignFrame(al,\r
+ av.applet,\r
+ "Original Data for PCA",\r
+ false);\r
+\r
+ af.viewport.setHiddenColumns( (ColumnSelection) alAndColsel[1] );\r
+ }\r
+ }\r
+\r
public void labels_itemStateChanged(ItemEvent itemEvent)\r
{\r
rc.showLabels( labels.getState() );\r
Menu menu2 = new Menu();\r
protected CheckboxMenuItem labels = new CheckboxMenuItem();\r
MenuItem values = new MenuItem();\r
+ MenuItem inputData = new MenuItem();\r
\r
private void jbInit()\r
throws Exception\r
labels.addItemListener(this);\r
values.setLabel("Output Values...");\r
values.addActionListener(this);\r
+ inputData.setLabel("Input Data...");\r
this.add(jPanel2, BorderLayout.SOUTH);\r
jPanel2.add(jLabel1, null);\r
jPanel2.add(xCombobox, null);\r
menuBar1.add(menu2);\r
menu2.add(labels);\r
menu1.add(values);\r
+ menu1.add(inputData);\r
+ inputData.addActionListener(this);\r
}\r
\r
}\r
catch (Exception e)\r
{\r
e.printStackTrace();\r
- }\r
+ }\r
this.ap = ap;\r
- float scores[][] = new float[ap.av.alignment.getHeight()][ap.av.alignment.\r
- getHeight()];\r
+ sequences = new Vector();\r
+\r
+ SequenceI[] seqs;\r
+ String[] seqStrings = ap.av.getViewAsString(true);\r
+\r
+ if (ap.av.getSelectionGroup() == null)\r
+ {\r
+ seqs = ap.av.alignment.getSequencesArray();\r
+ }\r
+ else\r
+ {\r
+ seqs = ap.av.getSelectionGroup().getSequencesInOrder(ap.av.alignment);\r
+ }\r
+\r
+ float scores[][] = new float[seqs.length][seqs.length];\r
double totscore = 0;\r
int count = ap.av.getSelectionGroup().getSize(false);\r
\r
Sequence seq;\r
+\r
for (int i = 1; i < count; i++)\r
{\r
for (int j = 0; j < i; j++)\r
{\r
- AlignSeq as = new AlignSeq(ap.av.getSelectionGroup().getSequenceAt(i),\r
- ap.av.getSelectionGroup().getSequenceAt(j),\r
- "pep");\r
+\r
+ AlignSeq as = new AlignSeq(seqs[i], seqStrings[i],\r
+ seqs[j], seqStrings[j], "pep");\r
\r
if (as.s1str.length() == 0 || as.s2str.length() == 0)\r
{\r
\r
as.calcScoreMatrix();\r
as.traceAlignment();\r
+\r
as.printAlignment(System.out);\r
scores[i][j] = (float) as.getMaxScore() / (float) as.getASeq1().length;\r
totscore = totscore + scores[i][j];\r
\r
textarea.append(as.getOutput());\r
-\r
seq = new Sequence(as.getS1().getName(),\r
as.getAStr1(),\r
- as.getS1().getStart(), as.getS1().getEnd()\r
+ as.getS1().getStart(),\r
+ as.getS1().getEnd()\r
);\r
sequences.addElement(seq);\r
\r
seq = new Sequence(as.getS2().getName(),\r
as.getAStr2(),\r
- as.getS2().getStart(), as.getS2().getEnd()\r
- );\r
-\r
+ as.getS2().getStart(),\r
+ as.getS2().getEnd());\r
sequences.addElement(seq);\r
}\r
}\r
\r
if (count > 2)\r
{\r
+ System.out.println(\r
+ "Pairwise alignment scaled similarity score matrix\n");\r
+\r
+ for (int i = 0; i < count; i++)\r
+ {\r
+ jalview.util.Format.print(System.out, "%s \n",\r
+ ("" + i) + " " +\r
+ seqs[i].getName());\r
+ }\r
+\r
+ System.out.println("\n");\r
+\r
for (int i = 0; i < count; i++)\r
{\r
for (int j = 0; j < i; j++)\r
scores[i][j] / totscore);\r
}\r
}\r
+\r
+ System.out.println("\n");\r
}\r
}\r
-\r
public void actionPerformed(ActionEvent evt)\r
{\r
if(evt.getSource()==viewInEditorButton)\r
}\r
\r
new AlignFrame(new Alignment(seq),\r
- ap.alignFrame.applet,\r
+ ap.av.applet,\r
"Pairwise Aligned Sequences",\r
false);\r
\r
import jalview.datamodel.*;\r
\r
public class ScalePanel\r
- extends Panel\r
+ extends Panel implements MouseMotionListener, MouseListener\r
{\r
\r
protected int offy = 4;\r
AlignmentPanel ap;\r
\r
boolean stretchingGroup = false;\r
+ int min; //used by mouseDragged to see if user\r
+ int max; //used by mouseDragged to see if user\r
+ boolean mouseDragging = false;\r
+ int [] reveal;\r
\r
public ScalePanel(AlignViewport av, AlignmentPanel ap)\r
{\r
this.av = av;\r
this.ap = ap;\r
\r
- addMouseListener(new MouseAdapter()\r
+ addMouseListener(this);\r
+ addMouseMotionListener(this);\r
+\r
+ }\r
+\r
+ public void mousePressed(MouseEvent evt)\r
+ {\r
+ int x = (evt.getX() / av.getCharWidth()) + av.getStartRes();\r
+ final int res;\r
+\r
+ if (av.hasHiddenColumns)\r
+ res = av.getColumnSelection().adjustForHiddenColumns(x);\r
+ else\r
+ res = x;\r
+\r
+ min = res;\r
+ max = res;\r
+ if (reveal != null\r
+ && (evt.getModifiers() & InputEvent.BUTTON3_MASK)\r
+ == InputEvent.BUTTON3_MASK)\r
{\r
- public void mousePressed(MouseEvent evt)\r
- {\r
- doMousePressed(evt);\r
- }\r
\r
- public void mouseReleased(MouseEvent evt)\r
+ MenuItem item = new MenuItem("Reveal");\r
+ item.addActionListener(new ActionListener()\r
{\r
- doMouseReleased(evt);\r
- }\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ av.showColumn(reveal[0]);\r
+ reveal = null;\r
+ ap.repaint();\r
+ if (ap.overviewPanel != null)\r
+ ap.overviewPanel.updateOverviewImage();\r
+ }\r
+ });\r
+ PopupMenu pop = new PopupMenu();\r
+ pop.add(item);\r
\r
- });\r
- addMouseMotionListener(new MouseMotionAdapter()\r
- {\r
- public void mouseDragged(MouseEvent evt)\r
+ if (av.getColumnSelection().getHiddenColumns().size() > 1)\r
{\r
- doMouseDragged(evt);\r
+ item = new MenuItem("Reveal All");\r
+ item.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ av.showAllHiddenColumns();\r
+ reveal = null;\r
+ ap.repaint();\r
+ if (ap.overviewPanel != null)\r
+ ap.overviewPanel.updateOverviewImage();\r
+ }\r
+ });\r
+ pop.add(item);\r
}\r
- });\r
-\r
- }\r
-\r
- public void doMousePressed(MouseEvent evt)\r
- {\r
- int x = evt.getX();\r
- int res = x / av.getCharWidth() + av.getStartRes();\r
- SequenceGroup sg = null;\r
\r
+ this.add(pop);\r
+ pop.show(this, evt.getX(), evt.getY());\r
\r
- if (av.getColumnSelection().contains(res))\r
+ }\r
+ else if (av.getColumnSelection().contains(res))\r
{\r
- av.getColumnSelection().removeElement(res);\r
+ if ( (evt.getModifiers() & InputEvent.BUTTON3_MASK)\r
+ == InputEvent.BUTTON3_MASK)\r
+ {\r
+ MenuItem item = new MenuItem("Hide Columns");\r
+ item.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ av.hideColumns(res, res);\r
+ ap.repaint();\r
+ if (ap.overviewPanel != null)\r
+ ap.overviewPanel.updateOverviewImage();\r
+ }\r
+ });\r
+ PopupMenu pop = new PopupMenu();\r
+ pop.add(item);\r
+ this.add(pop);\r
+ pop.show(this, evt.getX(), evt.getY());\r
+ }\r
+ else\r
+ {\r
+ av.getColumnSelection().removeElement(res);\r
+ av.setSelectionGroup(null);\r
+ }\r
}\r
else\r
{\r
av.getColumnSelection().addElement(res);\r
+ SequenceGroup sg = new SequenceGroup();\r
\r
- sg = new SequenceGroup();\r
for (int i = 0; i < av.alignment.getSequences().size(); i++)\r
{\r
sg.addSequence(av.alignment.getSequenceAt(i), false);\r
\r
sg.setStartRes(res);\r
sg.setEndRes(res);\r
-\r
- ap.annotationPanel.addEditableColumn(res);\r
+ av.setSelectionGroup(sg);\r
}\r
- av.setSelectionGroup(sg);\r
ap.repaint();\r
}\r
\r
- public void doMouseReleased(MouseEvent evt)\r
+ public void mouseReleased(MouseEvent evt)\r
{\r
- if (!stretchingGroup)\r
- {\r
- return;\r
- }\r
+ mouseDragging = false;\r
\r
- int x = evt.getX();\r
- int res = x / av.getCharWidth() + av.getStartRes();\r
+ int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();\r
\r
if(res> av.alignment.getWidth())\r
{\r
res = av.alignment.getWidth()-1;\r
}\r
\r
- if (!av.getColumnSelection().contains(res))\r
+ if(av.hasHiddenColumns)\r
+ res = av.getColumnSelection().adjustForHiddenColumns(res);\r
+\r
+ if (!stretchingGroup)\r
{\r
- av.getColumnSelection().addElement(res);\r
+ ap.repaint();\r
+\r
+ return;\r
}\r
\r
SequenceGroup sg = av.getSelectionGroup();\r
\r
if (res > sg.getStartRes())\r
{\r
- sg.setEndRes(res);\r
+ sg.setEndRes(res);\r
}\r
else if (res < sg.getStartRes())\r
{\r
- sg.setStartRes(res);\r
+ sg.setStartRes(res);\r
}\r
\r
stretchingGroup = false;\r
ap.repaint();\r
}\r
\r
- public void doMouseDragged(MouseEvent evt)\r
+ public void mouseDragged(MouseEvent evt)\r
{\r
- int x = evt.getX();\r
- int res = x / av.getCharWidth() + av.getStartRes();\r
+ mouseDragging = true;\r
\r
- if(res> av.alignment.getWidth())\r
+ int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();\r
+ if (res < 0)\r
+ res = 0;\r
+\r
+ if (av.hasHiddenColumns)\r
+ res = av.getColumnSelection().adjustForHiddenColumns(res);\r
+\r
+ if (res > av.alignment.getWidth())\r
{\r
- res = av.alignment.getWidth()-1;\r
+ res = av.alignment.getWidth() - 1;\r
+ }\r
+\r
+ if (res < min)\r
+ {\r
+ min = res;\r
+ }\r
+\r
+ if (res > max)\r
+ {\r
+ max = res;\r
}\r
\r
SequenceGroup sg = av.getSelectionGroup();\r
+\r
if (sg != null)\r
{\r
stretchingGroup = true;\r
+\r
+ if (!av.getColumnSelection().contains(res))\r
+ {\r
+ av.getColumnSelection().addElement(res);\r
+ }\r
+\r
if (res > sg.getStartRes())\r
{\r
sg.setEndRes(res);\r
}\r
- else if (res < sg.getStartRes())\r
+ if (res < sg.getStartRes())\r
{\r
sg.setStartRes(res);\r
}\r
\r
- ap.annotationPanel.addEditableColumn(res);\r
+ for (int i = min; i <= max; i++)\r
+ {\r
+ if ( (i < sg.getStartRes()) || (i > sg.getEndRes()))\r
+ {\r
+ av.getColumnSelection().removeElement(i);\r
+ }\r
+ else\r
+ {\r
+ av.getColumnSelection().addElement(i);\r
+ }\r
+ }\r
+\r
ap.repaint();\r
}\r
}\r
\r
+\r
+ public void mouseEntered(MouseEvent evt)\r
+ {\r
+ if (mouseDragging)\r
+ ap.seqPanel.scrollCanvas(null);\r
+ }\r
+\r
+ public void mouseExited(MouseEvent evt)\r
+ {\r
+ if (mouseDragging)\r
+ ap.seqPanel.scrollCanvas(evt);\r
+ }\r
+\r
+ public void mouseClicked(MouseEvent evt)\r
+ {\r
+\r
+ }\r
+\r
+ public void mouseMoved(MouseEvent evt)\r
+ {\r
+ if (!av.hasHiddenColumns)\r
+ return;\r
+\r
+ int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();\r
+\r
+ res = av.getColumnSelection().adjustForHiddenColumns(res);\r
+\r
+ reveal = null;\r
+ for (int i = 0; i < av.getColumnSelection().getHiddenColumns().size(); i++)\r
+ {\r
+ int[] region = (int[]) av.getColumnSelection().getHiddenColumns().\r
+ elementAt(i);\r
+ if (res + 1 == region[0] || res - 1 == region[1])\r
+ {\r
+ reveal = region;\r
+ break;\r
+ }\r
+ }\r
+\r
+ repaint();\r
+ }\r
+\r
public void update(Graphics g)\r
{\r
paint(g);\r
{\r
gg.setFont(av.getFont());\r
\r
+\r
//Fill in the background\r
gg.setColor(Color.white);\r
gg.fillRect(0, 0, width, height);\r
//Fill the selected columns\r
ColumnSelection cs = av.getColumnSelection();\r
gg.setColor(new Color(220, 0, 0));\r
+\r
for (int i = 0; i < cs.size(); i++)\r
{\r
- int sel = cs.columnAt(i);\r
- if (sel >= startx && sel <= endx)\r
- {\r
- gg.fillRect( (sel - startx) * av.charWidth, 0, av.charWidth,\r
- getSize().height);\r
- }\r
+ int sel = cs.columnAt(i);\r
+ if(av.hasHiddenColumns)\r
+ sel = av.getColumnSelection().findColumnPosition(sel);\r
+\r
+\r
+ if ((sel >= startx) && (sel <= endx))\r
+ {\r
+ gg.fillRect((sel - startx) * av.charWidth, 0, av.charWidth,\r
+ getSize().height);\r
+ }\r
}\r
\r
// Draw the scale numbers\r
gg.setColor(Color.black);\r
+\r
int scalestartx = (startx / 10) * 10;\r
\r
FontMetrics fm = gg.getFontMetrics(av.getFont());\r
int y = av.charHeight - fm.getDescent();\r
\r
- if (scalestartx % 10 == 0)\r
+ if ((scalestartx % 10) == 0)\r
{\r
- scalestartx += 5;\r
+ scalestartx += 5;\r
}\r
\r
String string;\r
\r
for (int i = scalestartx; i < endx; i += 5)\r
{\r
- if (i % 10 == 0)\r
- {\r
- string = String.valueOf(i);\r
- if ( (i - startx - 1) * av.charWidth > maxX)\r
+ if ((i % 10) == 0)\r
+ {\r
+ string = String.valueOf(av.getColumnSelection().adjustForHiddenColumns(i));\r
+ if ( (i - startx - 1) * av.charWidth > maxX)\r
+ {\r
+ gg.drawString(string,\r
+ (i - startx - 1) * av.charWidth, y);\r
+ maxX = (i - startx + 1) * av.charWidth + fm.stringWidth(string);\r
+ }\r
+\r
+ gg.drawLine( (int) ( ( (i - startx - 1) * av.charWidth) +\r
+ (av.charWidth / 2)), y + 2,\r
+ (int) ( ( (i - startx - 1) * av.charWidth) +\r
+ (av.charWidth / 2)),\r
+ y + (fm.getDescent() * 2));\r
+\r
+ }\r
+ else\r
{\r
- gg.drawString(string,\r
- (i - startx - 1) * av.charWidth, y);\r
- maxX = (i - startx + 1) * av.charWidth + fm.stringWidth(string);\r
+ gg.drawLine((int) (((i - startx - 1) * av.charWidth) +\r
+ (av.charWidth / 2)), y + fm.getDescent(),\r
+ (int) (((i - startx - 1) * av.charWidth) +\r
+ (av.charWidth / 2)), y + (fm.getDescent() * 2));\r
}\r
+ }\r
\r
- gg.drawLine( (int) ( (i - startx - 1) * av.charWidth + av.charWidth / 2),\r
- y + 2,\r
- (int) ( (i - startx - 1) * av.charWidth + av.charWidth / 2),\r
- y + fm.getDescent() * 2);\r
- }\r
- else\r
+ if (av.hasHiddenColumns)\r
+ {\r
+ gg.setColor(Color.blue);\r
+ int res;\r
+ if(av.getShowHiddenMarkers())\r
{\r
- gg.drawLine( (int) ( (i - startx - 1) * av.charWidth + av.charWidth / 2),\r
- y + fm.getDescent(),\r
- (int) ( (i - startx - 1) * av.charWidth + av.charWidth / 2),\r
- y + fm.getDescent() * 2);\r
+ for (int i = 0; i < av.getColumnSelection().getHiddenColumns().size();\r
+ i++)\r
+ {\r
+\r
+ res = av.getColumnSelection().findHiddenRegionPosition(i) -\r
+ startx;\r
+\r
+ if(res < 0 || res > endx-scalestartx)\r
+ continue;\r
+\r
+ gg.fillPolygon(new int[]\r
+ {res * av.charWidth - av.charHeight / 4,\r
+ res * av.charWidth + av.charHeight / 4,\r
+ res * av.charWidth},\r
+ new int[]\r
+ {\r
+ y - av.charHeight / 2, y - av.charHeight / 2,\r
+ y + 8\r
+ }, 3);\r
+\r
+ }\r
}\r
\r
+ if (reveal != null && reveal[0] > startx && reveal[0] < endx)\r
+ {\r
+ gg.drawString("Reveal Columns", reveal[0] * av.charWidth, 0);\r
+ }\r
}\r
+\r
}\r
\r
}\r
// NORTH SCALE\r
for (int i = scalestartx; i < endx; i += 10)\r
{\r
- String string = String.valueOf(i);\r
- g.drawString(string, (i - startx - 1) * av.charWidth,\r
- ypos - av.charHeight / 2);\r
+ int value = i;\r
+ if(av.hasHiddenColumns)\r
+ value = av.getColumnSelection().adjustForHiddenColumns(value);\r
\r
- g.drawLine( (i - startx - 1) * av.charWidth + av.charWidth / 2,\r
- ypos + 2 - av.charHeight / 2,\r
- (i - startx - 1) * av.charWidth + av.charWidth / 2, ypos - 2);\r
+ g.drawString( String.valueOf(value), (i - startx - 1) * av.charWidth,\r
+ ypos - (av.charHeight / 2));\r
\r
+ g.drawLine(((i - startx - 1) * av.charWidth) + (av.charWidth / 2),\r
+ (ypos + 2) - (av.charHeight / 2),\r
+ ((i - startx - 1) * av.charWidth) + (av.charWidth / 2), ypos -\r
+ 2);\r
}\r
}\r
\r
{\r
FontMetrics fm = getFontMetrics(av.getFont());\r
ypos += av.charHeight;\r
- // EAST SCALE\r
- for (int i = 0; i < av.alignment.getHeight(); i++)\r
+ if (av.hasHiddenColumns)\r
{\r
- SequenceI seq = av.alignment.getSequenceAt(i);\r
- int index = startx;\r
- int value = -1;\r
- while (index < endx)\r
+ startx = av.getColumnSelection().adjustForHiddenColumns(startx);\r
+ endx = av.getColumnSelection().adjustForHiddenColumns(endx);\r
+ }\r
+\r
+ int maxwidth = av.alignment.getWidth();\r
+ if (av.hasHiddenColumns)\r
+ maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;\r
+\r
+ // WEST SCALE\r
+ for (int i = 0; i < av.alignment.getHeight(); i++)\r
{\r
- if (jalview.util.Comparison.isGap(seq.getCharAt(index)))\r
+ SequenceI seq = av.alignment.getSequenceAt(i);\r
+ int index = startx;\r
+ int value = -1;\r
+\r
+ while (index < endx)\r
{\r
- index++;\r
- continue;\r
+ if (jalview.util.Comparison.isGap(seq.getCharAt(index)))\r
+ {\r
+ index++;\r
+\r
+ continue;\r
+ }\r
+\r
+ value = av.alignment.getSequenceAt(i).findPosition(index);\r
+\r
+ break;\r
}\r
\r
- value = av.alignment.getSequenceAt(i).findPosition(index);\r
- break;\r
- }\r
- if (value != -1)\r
- {\r
- int x = LABEL_WEST - fm.stringWidth(String.valueOf(value))-av.charWidth/2;\r
- g.drawString(value + "", x,\r
- ypos + i * av.charHeight - av.charHeight / 5);\r
+ if (value != -1)\r
+ {\r
+ int x = LABEL_WEST - fm.stringWidth(String.valueOf(value)) -\r
+ av.charWidth / 2;\r
+ g.drawString(value + "", x,\r
+ (ypos + (i * av.charHeight)) - (av.charHeight / 5));\r
+ }\r
}\r
}\r
- }\r
-\r
void drawEastScale(Graphics g, int startx, int endx, int ypos)\r
{\r
- ypos += av.charHeight;\r
- // EAST SCALE\r
- for (int i = 0; i < av.alignment.getHeight(); i++)\r
- {\r
- SequenceI seq = av.alignment.getSequenceAt(i);\r
- int index = endx;\r
- int value = -1;\r
- while (index > startx)\r
- {\r
- if (jalview.util.Comparison.isGap(seq.getCharAt(index)))\r
+ ypos += av.charHeight;\r
+\r
+ if(av.hasHiddenColumns)\r
+ endx = av.getColumnSelection().adjustForHiddenColumns(endx);\r
+\r
+ SequenceI seq;\r
+ // EAST SCALE\r
+ for (int i = 0; i < av.alignment.getHeight(); i++)\r
{\r
- index--;\r
- continue;\r
- }\r
+ seq = av.alignment.getSequenceAt(i);\r
+ int index = endx;\r
+ int value = -1;\r
\r
- value = seq.findPosition(index);\r
- break;\r
- }\r
- if (value != -1)\r
- {\r
- g.drawString(value + "", av.charWidth/2,\r
- ypos + i * av.charHeight - av.charHeight / 5);\r
- }\r
- }\r
+ while (index > startx)\r
+ {\r
+ if (jalview.util.Comparison.isGap(seq.getCharAt(index)))\r
+ {\r
+ index--;\r
\r
- }\r
+ continue;\r
+ }\r
+\r
+ value = seq.findPosition(index);\r
+\r
+ break;\r
+ }\r
+\r
+ if (value != -1)\r
+ {\r
+ g.drawString(String.valueOf(value), 0,\r
+ (ypos + (i * av.charHeight)) - (av.charHeight / 5));\r
+ }\r
+ }\r
+ }\r
\r
int lastsr=0;\r
void fastPaint(int horizontal, int vertical)\r
int endx;\r
int ypos = hgap;\r
\r
+ int maxwidth = av.alignment.getWidth();\r
+\r
+ if(av.hasHiddenColumns)\r
+ maxwidth = av.getColumnSelection().findColumnPosition(maxwidth)-1;\r
\r
- while ((ypos <= canvasHeight) && (startRes < av.alignment.getWidth()))\r
+ while ((ypos <= canvasHeight) && (startRes < maxwidth))\r
{\r
endx = startRes + cWidth -1;\r
\r
- if (endx > al.getWidth())\r
+ if (endx > maxwidth)\r
{\r
- endx = al.getWidth();\r
+ endx = maxwidth;\r
}\r
\r
g.setColor(Color.black);\r
\r
if (av.scaleAboveWrapped)\r
{\r
- drawNorthScale(g, startRes, endx, ypos);\r
+ drawNorthScale(g, startRes, endx, ypos);\r
+ }\r
+ if (av.hasHiddenColumns && av.showHiddenMarkers)\r
+ {\r
+ g.setColor(Color.blue);\r
+ int res;\r
+ for (int i = 0; i < av.getColumnSelection().getHiddenColumns().size();\r
+ i++)\r
+ {\r
+ res = av.getColumnSelection().findHiddenRegionPosition(i) -\r
+ startRes;\r
+\r
+ if (res < 0 || res > endx - startRes)\r
+ continue;\r
+\r
+ gg.fillPolygon(new int[]\r
+ {res * av.charWidth - av.charHeight / 4,\r
+ res * av.charWidth + av.charHeight / 4,\r
+ res * av.charWidth},\r
+ new int[]\r
+ {\r
+ ypos - (av.charHeight / 2),\r
+ ypos - (av.charHeight / 2),\r
+ ypos - (av.charHeight / 2) + 8\r
+ }, 3);\r
+\r
+ }\r
}\r
\r
if(g.getClip()==null)\r
return annotations.adjustPanelHeight();\r
}\r
\r
- void drawPanel(Graphics g, int startRes, int endRes, int startSeq, int endSeq, int offset)\r
- {\r
- g.setFont(av.getFont());\r
- sr.renderGaps(av.renderGaps);\r
+ void drawPanel(Graphics g1, int startRes, int endRes,\r
+ int startSeq, int endSeq, int offset)\r
+ {\r
+ if(!av.hasHiddenColumns)\r
+ {\r
+ draw(g1, startRes, endRes, startSeq, endSeq, offset);\r
+ }\r
+ else\r
+ {\r
+ java.util.Vector regions = av.getColumnSelection().getHiddenColumns();\r
\r
- SequenceI nextSeq;\r
- /// First draw the sequences\r
- /////////////////////////////\r
- for (int i = startSeq; i < endSeq; i++)\r
- {\r
- nextSeq = av.alignment.getSequenceAt(i);\r
+ int screenY = 0;\r
+ int blockStart = startRes;\r
+ int blockEnd = endRes;\r
+\r
+ for (int i = 0; i < regions.size(); i++)\r
+ {\r
+ int[] region = (int[]) regions.elementAt(i);\r
+ int hideStart = region[0];\r
+ int hideEnd = region[1];\r
\r
- sr.drawSequence(g, nextSeq, av.alignment.findAllGroups(nextSeq), startRes, endRes,\r
- offset + ( (i - startSeq) * av.charHeight));\r
+ if (hideStart <= blockStart)\r
+ {\r
+ blockStart += (hideEnd - hideStart) + 1;\r
+ continue;\r
+ }\r
\r
- if (av.showSequenceFeatures)\r
- {\r
- fr.drawSequence(g, nextSeq, startRes, endRes,\r
- offset + ((i - startSeq) * av.charHeight),\r
- av.charWidth, av.charHeight);\r
- }\r
- /// Highlight search Results once all sequences have been drawn\r
- //////////////////////////////////////////////////////////\r
- if (searchResults != null)\r
- {\r
- int[] visibleResults = searchResults.getResults(nextSeq, startRes, endRes);\r
- if (visibleResults != null)\r
- for (int r = 0; r < visibleResults.length; r += 2)\r
- {\r
- sr.drawHighlightedText(nextSeq, visibleResults[r],\r
- visibleResults[r + 1],\r
- (visibleResults[r] - startRes) * av.charWidth,\r
- offset + ( (i - startSeq) * av.charHeight),\r
- av.charWidth, av.charHeight);\r
- }\r
- }\r
+ blockEnd = hideStart - 1;\r
\r
- if (av.cursorMode && cursorY == i\r
- && cursorX >= startRes && cursorX <= endRes)\r
- {\r
- sr.drawCursor(nextSeq, cursorX, (cursorX - startRes) * av.charWidth,\r
- offset + ( (i - startSeq) * av.charHeight));\r
- }\r
+ g1.translate(screenY * av.charWidth, 0);\r
\r
- }\r
+ draw(g1, blockStart, blockEnd, startSeq, endSeq, offset);\r
\r
- //\r
- /////////////////////////////////////\r
- // Now outline any areas if necessary\r
- /////////////////////////////////////\r
- SequenceGroup group = av.getSelectionGroup();\r
+ if(av.getShowHiddenMarkers())\r
+ {\r
+ g1.setColor(Color.blue);\r
+ g1.drawLine( (blockEnd - blockStart + 1) * av.charWidth - 1,\r
+ startSeq + offset,\r
+ (blockEnd - blockStart + 1) * av.charWidth - 1,\r
+ startSeq + (endSeq - startSeq) * av.charHeight + offset);\r
+ }\r
\r
- int sx = -1;\r
- int sy = -1;\r
- int ex = -1;\r
- int groupIndex = -1;\r
+ g1.translate( -screenY * av.charWidth, 0);\r
+ screenY += blockEnd - blockStart + 1;\r
+ blockStart = hideEnd + 1;\r
+ }\r
\r
- if ((group == null) && (av.alignment.getGroups().size() > 0))\r
- {\r
- group = (SequenceGroup) av.alignment.getGroups().elementAt(0);\r
- groupIndex = 0;\r
- }\r
+ if (screenY <= (endRes - startRes))\r
+ {\r
+ blockEnd = blockStart + (endRes - startRes) - screenY;\r
+ g1.translate(screenY * av.charWidth, 0);\r
+ draw(g1, blockStart, blockEnd, startSeq, endSeq, offset);\r
\r
- if ( group != null )\r
- {\r
- do\r
- {\r
- int oldY = -1;\r
- int i = 0;\r
- boolean inGroup = false;\r
- int top = -1;\r
- int bottom = -1;\r
- int alHeight = av.alignment.getHeight()-1;\r
-\r
- for (i = startSeq; i < endSeq; i++)\r
- {\r
- sx = (group.getStartRes() - startRes) * av.charWidth;\r
- sy = offset + ((i - startSeq) * av.charHeight);\r
- ex = (((group.getEndRes() + 1) - group.getStartRes()) * av.charWidth) -\r
- 1;\r
-\r
- if(sx+ex<0 || sx>imgWidth)\r
- {\r
- continue;\r
- }\r
-\r
- if ( (sx <= (endRes-startRes)*av.charWidth) &&\r
- group.getSequences(false).contains(av.alignment.getSequenceAt(\r
- i)))\r
- {\r
- if ( (bottom == -1) &&\r
- (i >= alHeight ||\r
- !group.getSequences(false).contains(\r
- av.alignment.getSequenceAt(i + 1))))\r
- {\r
- bottom = sy + av.charHeight;\r
- }\r
+ g1.translate( -screenY * av.charWidth, 0);\r
+ }\r
+ }\r
\r
- if (!inGroup)\r
- {\r
- if (((top == -1) && (i == 0)) ||\r
- !group.getSequences(false).contains(\r
- av.alignment.getSequenceAt(i - 1)))\r
- {\r
- top = sy;\r
- }\r
-\r
- oldY = sy;\r
- inGroup = true;\r
-\r
- if (group == av.getSelectionGroup())\r
- {\r
- g.setColor(Color.red);\r
- }\r
- else\r
- {\r
- g.setColor(group.getOutlineColour());\r
- }\r
- }\r
- }\r
- else\r
- {\r
- if (inGroup)\r
- {\r
- if (sx >= 0 && sx < imgWidth)\r
- g.drawLine(sx, oldY, sx, sy);\r
-\r
- if (sx + ex < imgWidth)\r
- g.drawLine(sx + ex, oldY, sx + ex, sy);\r
-\r
- if (sx < 0)\r
- {\r
- ex += sx;\r
- sx = 0;\r
- }\r
-\r
- if (sx + ex > imgWidth)\r
- ex = imgWidth;\r
-\r
- else if (sx + ex >= (endRes - startRes + 1) * av.charWidth)\r
- ex = (endRes - startRes + 1) * av.charWidth;\r
-\r
- if (top != -1)\r
- {\r
- g.drawLine(sx, top, sx + ex, top);\r
- top = -1;\r
- }\r
-\r
- if (bottom != -1)\r
- {\r
- g.drawLine(sx, bottom, sx + ex, bottom);\r
- bottom = -1;\r
- }\r
-\r
- inGroup = false;\r
- }\r
- }\r
- }\r
+ }\r
\r
- if (inGroup)\r
- {\r
- sy = offset + ( (i - startSeq) * av.charHeight);\r
- if (sx >= 0 && sx < imgWidth)\r
- g.drawLine(sx, oldY, sx, sy);\r
\r
- if (sx + ex < imgWidth)\r
- g.drawLine(sx + ex, oldY, sx + ex, sy);\r
\r
- if (sx < 0)\r
- {\r
- ex += sx;\r
- sx = 0;\r
- }\r
\r
- if (sx + ex > imgWidth)\r
- ex = imgWidth;\r
- else if (sx + ex >= (endRes - startRes + 1) * av.charWidth)\r
- ex = (endRes - startRes + 1) * av.charWidth;\r
+ //int startRes, int endRes, int startSeq, int endSeq, int x, int y,\r
+ // int x1, int x2, int y1, int y2, int startx, int starty,\r
+ void draw(Graphics g,\r
+ int startRes, int endRes,\r
+ int startSeq, int endSeq,\r
+ int offset)\r
+ {\r
+ g.setFont(av.getFont());\r
+ sr.prepare(g, av.renderGaps);\r
+\r
+ SequenceI nextSeq;\r
\r
- if (top != -1)\r
+ /// First draw the sequences\r
+ /////////////////////////////\r
+ for (int i = startSeq; i < endSeq; i++)\r
+ {\r
+ nextSeq = av.alignment.getSequenceAt(i);\r
+\r
+ sr.drawSequence(nextSeq, av.alignment.findAllGroups(nextSeq),\r
+ startRes, endRes,\r
+ offset + ( (i - startSeq) * av.charHeight));\r
+\r
+ if (av.showSequenceFeatures)\r
{\r
- g.drawLine(sx, top, sx + ex, top);\r
- top = -1;\r
+ fr.drawSequence(g, nextSeq, startRes, endRes,\r
+ offset + ((i - startSeq) * av.charHeight));\r
}\r
\r
- if (bottom != -1)\r
+ /// Highlight search Results once all sequences have been drawn\r
+ //////////////////////////////////////////////////////////\r
+ if (searchResults != null)\r
{\r
- g.drawLine(sx, bottom - 1, sx + ex, bottom - 1);\r
- bottom = -1;\r
+ int[] visibleResults = searchResults.getResults(nextSeq, startRes, endRes);\r
+ if (visibleResults != null)\r
+ for (int r = 0; r < visibleResults.length; r += 2)\r
+ {\r
+ sr.drawHighlightedText(nextSeq, visibleResults[r],\r
+ visibleResults[r + 1],\r
+ (visibleResults[r] - startRes) * av.charWidth,\r
+ offset + ( (i - startSeq) * av.charHeight));\r
+ }\r
}\r
\r
- inGroup = false;\r
+ if(av.cursorMode && cursorY==i\r
+ && cursorX>=startRes && cursorX<=endRes)\r
+ {\r
+ sr.drawCursor(nextSeq, cursorX, (cursorX - startRes) * av.charWidth,\r
+ offset + ( (i - startSeq) * av.charHeight));\r
+ }\r
}\r
\r
- groupIndex++;\r
+ if(av.getSelectionGroup()!=null || av.alignment.getGroups().size()>0)\r
+ drawGroupsBoundaries(g, startRes, endRes, startSeq, endSeq, offset);\r
\r
- if (groupIndex >= av.alignment.getGroups().size())\r
- {\r
- break;\r
- }\r
+ }\r
\r
- group = (SequenceGroup) av.alignment.getGroups().elementAt(groupIndex);\r
- }\r
- while (groupIndex < av.alignment.getGroups().size());\r
- }\r
- }\r
+ void drawGroupsBoundaries(Graphics g,\r
+ int startRes, int endRes,\r
+ int startSeq, int endSeq,\r
+ int offset)\r
+ {\r
+ //\r
+ /////////////////////////////////////\r
+ // Now outline any areas if necessary\r
+ /////////////////////////////////////\r
+ SequenceGroup group = av.getSelectionGroup();\r
+\r
+ int sx = -1;\r
+ int sy = -1;\r
+ int ex = -1;\r
+ int groupIndex = -1;\r
+\r
+ if ( (group == null) && (group.getSize(false) > 0))\r
+ {\r
+ group = (SequenceGroup) av.alignment.getGroups().elementAt(0);\r
+ groupIndex = 0;\r
+ }\r
+\r
+ if (group != null)\r
+ {\r
+ do\r
+ {\r
+ int oldY = -1;\r
+ int i = 0;\r
+ boolean inGroup = false;\r
+ int top = -1;\r
+ int bottom = -1;\r
+ int alHeight = av.alignment.getHeight()-1;\r
+\r
+ for (i = startSeq; i < endSeq; i++)\r
+ {\r
+ sx = (group.getStartRes() - startRes) * av.charWidth;\r
+ sy = offset + ( (i - startSeq) * av.charHeight);\r
+ ex = ( ( (group.getEndRes() + 1) - group.getStartRes()) * av.charWidth) -\r
+ 1;\r
+\r
+ if (sx + ex < 0 || sx > imgWidth)\r
+ {\r
+ continue;\r
+ }\r
+\r
+ if ( (sx <= (endRes - startRes) * av.charWidth) &&\r
+ group.getSequences(false).\r
+ contains(av.alignment.getSequenceAt(i)))\r
+ {\r
+ if ( (bottom == -1) &&\r
+ (i >= alHeight ||\r
+ !group.getSequences(false).contains(\r
+ av.alignment.getSequenceAt(i + 1))))\r
+ {\r
+ bottom = sy + av.charHeight;\r
+ }\r
+\r
+ if (!inGroup)\r
+ {\r
+ if ( ( (top == -1) && (i == 0)) ||\r
+ !group.getSequences(false).contains(\r
+ av.alignment.getSequenceAt(i - 1)))\r
+ {\r
+ top = sy;\r
+ }\r
+\r
+ oldY = sy;\r
+ inGroup = true;\r
+\r
+ if (group == av.getSelectionGroup())\r
+ {\r
+ g.setColor(Color.red);\r
+ }\r
+ else\r
+ {\r
+ g.setColor(group.getOutlineColour());\r
+ }\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if (inGroup)\r
+ {\r
+ if (sx >= 0 && sx < imgWidth)\r
+ g.drawLine(sx, oldY, sx, sy);\r
+\r
+ if (sx + ex < imgWidth)\r
+ g.drawLine(sx + ex, oldY, sx + ex, sy);\r
+\r
+ if (sx < 0)\r
+ {\r
+ ex += sx;\r
+ sx = 0;\r
+ }\r
+\r
+ if (sx + ex > imgWidth)\r
+ ex = imgWidth;\r
+\r
+ else if (sx + ex >= (endRes - startRes + 1) * av.charWidth)\r
+ ex = (endRes - startRes + 1) * av.charWidth;\r
+\r
+ if (top != -1)\r
+ {\r
+ g.drawLine(sx, top, sx + ex, top);\r
+ top = -1;\r
+ }\r
+\r
+ if (bottom != -1)\r
+ {\r
+ g.drawLine(sx, bottom, sx + ex, bottom);\r
+ bottom = -1;\r
+ }\r
+\r
+ inGroup = false;\r
+ }\r
+ }\r
+ }\r
+\r
+ if (inGroup)\r
+ {\r
+ sy = offset + ( (i - startSeq) * av.charHeight);\r
+ if (sx >= 0 && sx < imgWidth)\r
+ g.drawLine(sx, oldY, sx, sy);\r
+\r
+ if (sx + ex < imgWidth)\r
+ g.drawLine(sx + ex, oldY, sx + ex, sy);\r
+\r
+ if (sx < 0)\r
+ {\r
+ ex += sx;\r
+ sx = 0;\r
+ }\r
+\r
+ if (sx + ex > imgWidth)\r
+ ex = imgWidth;\r
+ else if (sx + ex >= (endRes - startRes + 1) * av.charWidth)\r
+ ex = (endRes - startRes + 1) * av.charWidth;\r
+\r
+ if (top != -1)\r
+ {\r
+ g.drawLine(sx, top, sx + ex, top);\r
+ top = -1;\r
+ }\r
+\r
+ if (bottom != -1)\r
+ {\r
+ g.drawLine(sx, bottom - 1, sx + ex, bottom - 1);\r
+ bottom = -1;\r
+ }\r
+\r
+ inGroup = false;\r
+ }\r
+\r
+ groupIndex++;\r
+\r
+ if (groupIndex >= av.alignment.getGroups().size())\r
+ {\r
+ break;\r
+ }\r
+\r
+ group = (SequenceGroup) av.alignment.getGroups().elementAt(groupIndex);\r
+ }\r
+ while (groupIndex < av.alignment.getGroups().size());\r
+\r
+ }\r
+ }\r
\r
public void highlightSearchResults(SearchResults results)\r
{\r
res = (x / av.getCharWidth()) + av.getStartRes();\r
}\r
\r
+ if(av.hasHiddenColumns)\r
+ res = av.getColumnSelection().adjustForHiddenColumns(res);\r
+\r
return res;\r
\r
}\r
{\r
if (obj != "")\r
{\r
- text.append(obj + " (" +\r
- av.getAlignment().getSequenceAt(seq).findPosition(res) + ")");\r
+ text.append(obj + " (" + sequence.findPosition(res) + ")");\r
}\r
}\r
\r
}\r
\r
synchronized void editSequence(boolean insertGap, int startres)\r
- {\r
- int fixedLeft = -1;\r
- int fixedRight = -1;\r
- boolean fixedColumns = false;\r
- SequenceGroup sg = av.getSelectionGroup();\r
+ {\r
+ int fixedLeft = -1;\r
+ int fixedRight = -1;\r
+ boolean fixedColumns = false;\r
+ SequenceGroup sg = av.getSelectionGroup();\r
\r
- if(groupEditing && sg==null)\r
- return;\r
\r
- SequenceI seq = av.alignment.getSequenceAt(startseq);\r
- StringBuffer message = new StringBuffer();\r
- if (groupEditing)\r
- message.append("Edit group:");\r
- else\r
- message.append("Edit sequence: "+seq.getName());\r
+ if (!groupEditing && av.hasHiddenRows)\r
+ {\r
+ if (av.alignment.getSequenceAt(startseq).getHiddenSequences() != null)\r
+ {\r
+ groupEditing = true;\r
+ }\r
+ }\r
\r
- if(insertGap)\r
- message.append(" insert ");\r
- else\r
- message.append(" delete ");\r
+ //No group, but the sequence may represent a group\r
+ if (groupEditing\r
+ && sg == null\r
+ && av.alignment.getSequenceAt(startseq).getHiddenSequences() == null)\r
+ {\r
+ groupEditing = false;\r
+ }\r
+\r
+ SequenceI seq = av.alignment.getSequenceAt(startseq);\r
+ StringBuffer message = new StringBuffer();\r
+ if (groupEditing)\r
+ message.append("Edit group:");\r
+ else\r
+ message.append("Edit sequence: "+seq.getName());\r
+\r
+ if(insertGap)\r
+ message.append(" insert ");\r
+ else\r
+ message.append(" delete ");\r
\r
- message.append(Math.abs(startres-lastres)+" gaps.");\r
- ap.alignFrame.statusBar.setText(message.toString());\r
+ message.append(Math.abs(startres-lastres)+" gaps.");\r
+ ap.alignFrame.statusBar.setText(message.toString());\r
\r
\r
- //Are we editing within a selection group?\r
- if (groupEditing\r
- || (sg != null && sg.getSequences(false).contains(seq)))\r
+ //Are we editing within a selection group?\r
+ if (groupEditing\r
+ || (sg != null && sg.getSequences(true).contains(seq)))\r
+ {\r
+ fixedColumns = true;\r
+\r
+ //sg might be null as the user may only see 1 sequence,\r
+ //but the sequence represents a group\r
+ if (sg == null)\r
{\r
- fixedColumns = true;\r
+ sg = new SequenceGroup(null, null, false, false, false, 0,\r
+ av.alignment.getWidth()-1);\r
+ sg.addSequence(av.alignment.getSequenceAt(startseq), false);\r
+ }\r
+\r
+ fixedLeft = sg.getStartRes();\r
+ fixedRight = sg.getEndRes();\r
+\r
+ if ( (startres < fixedLeft && lastres >= fixedLeft)\r
+ || (startres >= fixedLeft && lastres < fixedLeft)\r
+ || (startres > fixedRight && lastres <=fixedRight)\r
+ || (startres <= fixedRight && lastres > fixedRight))\r
+ {\r
+ endEditing();\r
+ return;\r
+ }\r
+\r
+ if (fixedLeft > startres)\r
+ {\r
+ fixedRight = fixedLeft - 1;\r
+ fixedLeft = 0;\r
+ }\r
+ else if (fixedRight < startres)\r
+ {\r
+ fixedLeft = fixedRight;\r
+ fixedRight = -1;\r
+ }\r
+ }\r
\r
- fixedLeft = sg.getStartRes();\r
- fixedRight = sg.getEndRes();\r
\r
- if ( (startres < fixedLeft && lastres >= fixedLeft)\r
- || (startres >= fixedLeft && lastres < fixedLeft)\r
- || (startres > fixedRight && lastres <=fixedRight)\r
- || (startres <= fixedRight && lastres > fixedRight))\r
+ if(av.hasHiddenColumns )\r
+ {\r
+ fixedColumns = true;\r
+ int y1 = av.getColumnSelection().getHiddenBoundaryLeft(startres);\r
+ int y2 = av.getColumnSelection().getHiddenBoundaryRight(startres);\r
+\r
+ if ( (insertGap && startres > y1 && lastres < y1)\r
+ || (!insertGap && startres < y2 && lastres > y2))\r
{\r
endEditing();\r
return;\r
}\r
\r
- if (fixedLeft > startres)\r
- {\r
- fixedRight = fixedLeft - 1;\r
- fixedLeft = 0;\r
- }\r
- else if (fixedRight < startres)\r
+ //System.out.print(y1+" "+y2+" "+fixedLeft+" "+fixedRight+"~~");\r
+ //Selection spans a hidden region\r
+ if(fixedLeft<y1 && (fixedRight>y2 || fixedRight==-1))\r
{\r
- fixedLeft = fixedRight;\r
- fixedRight = -1;\r
+ if(startres>=y2)\r
+ {\r
+ fixedLeft = y2;\r
+ }\r
+ else\r
+ {\r
+ fixedRight = y2 - 1;\r
+ }\r
}\r
- }\r
+ }\r
\r
\r
- if (groupEditing)\r
+ if (groupEditing)\r
+ {\r
+ // drag to right\r
+ if (insertGap)\r
{\r
- // drag to right\r
- if (insertGap)\r
- {\r
- //If the user has selected the whole sequence, and is dragging to\r
- // the right, we can still extend the alignment and selectionGroup\r
- if(sg.getStartRes() == 0 && sg.getEndRes() + 1 == av.alignment.getWidth())\r
- {\r
- sg.setEndRes(av.alignment.getWidth() + startres - lastres);\r
- fixedRight = sg.getEndRes();\r
- }\r
+ //If the user has selected the whole sequence, and is dragging to\r
+ // the right, we can still extend the alignment and selectionGroup\r
+ if( sg.getStartRes() == 0\r
+ && sg.getEndRes() == fixedRight\r
+ && sg.getEndRes() == av.alignment.getWidth()-1\r
+ )\r
+ {\r
+ sg.setEndRes(av.alignment.getWidth() + startres - lastres);\r
+ fixedRight = sg.getEndRes();\r
+ }\r
\r
- // Is it valid with fixed columns??\r
- // Find the next gap before the end\r
- // of the visible region boundary\r
- boolean blank = false;\r
- for (fixedRight = fixedRight;\r
- fixedRight > lastres;\r
- fixedRight--)\r
+ // Is it valid with fixed columns??\r
+ // Find the next gap before the end\r
+ // of the visible region boundary\r
+ boolean blank = false;\r
+ for (fixedRight = fixedRight;\r
+ fixedRight > lastres;\r
+ fixedRight--)\r
+ {\r
+ blank = true;\r
+ for (int s = 0; s < sg.getSize(true); s++)\r
{\r
- blank = true;\r
- for (int s = 0; s < sg.getSize(false); s++)\r
+ seq = (SequenceI)sg.getSequences(true).elementAt(s);\r
+ for (int j = 0; j < startres - lastres; j++)\r
{\r
- seq = sg.getSequenceAt(s);\r
- for (int j = 0; j < startres - lastres; j++)\r
+ if (!jalview.util.Comparison.isGap(\r
+ seq.getCharAt(fixedRight - j)))\r
{\r
- if (!jalview.util.Comparison.isGap(\r
- seq.getCharAt(fixedRight - j)))\r
- {\r
- blank = false;\r
- break;\r
- }\r
+ blank = false;\r
+ break;\r
}\r
}\r
- if (blank)\r
- break;\r
}\r
+ if (blank)\r
+ break;\r
+ }\r
\r
- if (!blank)\r
+ if (!blank)\r
+ {\r
+ if(sg.getSize(false) == av.alignment.getHeight() )\r
{\r
- if(sg.getSize(false) == av.alignment.getHeight())\r
- {\r
- //We can still insert gaps if the selectionGroup\r
- //contains all the sequences\r
- sg.setEndRes(sg.getEndRes()+startres-lastres);\r
- fixedRight = av.alignment.getWidth()+startres-lastres;\r
- }\r
- else\r
+ if((av.hasHiddenColumns\r
+ && startres<av.getColumnSelection().getHiddenBoundaryRight(startres)))\r
{\r
endEditing();\r
return;\r
}\r
- }\r
- }\r
-\r
-\r
- // drag to left\r
- else if(!insertGap)\r
- {\r
- /// Are we able to delete?\r
- // ie are all columns blank?\r
\r
- for (int s = 0; s < sg.getSize(false); s++)\r
- {\r
- seq = sg.getSequenceAt(s);\r
-\r
- for (int j = startres; j < lastres; j++)\r
+ int alWidth = av.alignment.getWidth();\r
+ if(av.hasHiddenRows)\r
{\r
- if (seq.getSequence().length() <= j)\r
- {\r
- continue;\r
- }\r
-\r
- if (!jalview.util.Comparison.isGap(\r
- seq.getSequence().charAt(j)))\r
- {\r
- // Not a gap, block edit not valid\r
- endEditing();\r
- return;\r
- }\r
+ int hwidth = av.alignment.getHiddenSequences().getWidth();\r
+ if(hwidth>alWidth)\r
+ alWidth = hwidth;\r
}\r
+ //We can still insert gaps if the selectionGroup\r
+ //contains all the sequences\r
+ sg.setEndRes(sg.getEndRes()+startres-lastres);\r
+ fixedRight = alWidth+startres-lastres;\r
+ }\r
+ else\r
+ {\r
+ endEditing();\r
+ return;\r
}\r
}\r
+ }\r
\r
\r
- for (int i = 0; i < sg.getSize(false); i++)\r
+ // drag to left\r
+ else if(!insertGap)\r
+ {\r
+ /// Are we able to delete?\r
+ // ie are all columns blank?\r
+\r
+ for (int s = 0; s < sg.getSize(true); s++)\r
{\r
- seq = sg.getSequenceAt(i);\r
+ seq = (SequenceI)sg.getSequences(true).elementAt(s);\r
\r
- if (insertGap)\r
+ for (int j = startres; j < lastres; j++)\r
{\r
- // dragging to the right\r
- for (int j = lastres; j < startres; j++)\r
+ if (seq.getSequence().length() <= j)\r
{\r
- if (fixedColumns && fixedRight != -1)\r
- {\r
- insertChar(j, seq, fixedRight);\r
- }\r
- else\r
- insertChar(j, seq);\r
+ continue;\r
}\r
- }\r
- else\r
- {\r
- // dragging to the left\r
- for (int j = lastres; j > startres; j--)\r
+\r
+ if (!jalview.util.Comparison.isGap(\r
+ seq.getSequence().charAt(j)))\r
{\r
- if (fixedColumns && fixedRight != -1)\r
- {\r
- deleteChar(startres, seq, fixedRight);\r
- }\r
- else\r
- {\r
- deleteChar(startres, seq);\r
- }\r
+ // Not a gap, block edit not valid\r
+ endEditing();\r
+ return;\r
}\r
}\r
}\r
}\r
- else /////Editing a single sequence///////////\r
+\r
+\r
+ for (int i = 0; i < sg.getSize(true); i++)\r
{\r
+ seq = (SequenceI) sg.getSequences(true).elementAt(i);\r
+\r
if (insertGap)\r
{\r
// dragging to the right\r
{\r
if (fixedColumns && fixedRight != -1)\r
{\r
- if (sg.getStartRes() == 0\r
- && sg.getEndRes() + 1 == av.alignment.getWidth()\r
- && !jalview.util.Comparison.isGap(seq.getCharAt(fixedRight)))\r
- {\r
- //Single sequence edit, whole sequence selected,\r
- //extend the selection group\r
- sg.setEndRes(av.alignment.getWidth() -1 + startres - lastres);\r
- fixedColumns = false;\r
- insertChar(j, seq);\r
- }\r
- else\r
- insertChar(j, seq, fixedRight);\r
+ insertChar(j, seq, fixedRight);\r
}\r
else\r
insertChar(j, seq);\r
}\r
}\r
}\r
+ }\r
+ else /////Editing a single sequence///////////\r
+ {\r
+ if (insertGap)\r
+ {\r
+ // dragging to the right\r
+ for (int j = lastres; j < startres; j++)\r
+ {\r
+ if (fixedColumns && fixedRight != -1)\r
+ {\r
+ insertChar(j, seq, fixedRight);\r
+ }\r
+ else\r
+ insertChar(j, seq);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ // dragging to the left\r
+ for (int j = lastres; j > startres; j--)\r
+ {\r
+ if (fixedColumns && fixedRight != -1)\r
+ {\r
+ deleteChar(startres, seq, fixedRight);\r
+ }\r
+ else\r
+ {\r
+ deleteChar(startres, seq);\r
+ }\r
+ }\r
+ }\r
+ }\r
\r
- lastres = startres;\r
- seqCanvas.repaint();\r
- }\r
+ lastres = startres;\r
+ seqCanvas.repaint();\r
+ }\r
\r
\r
/**\r
}\r
}\r
\r
+ void scrollCanvas(MouseEvent evt)\r
+ {\r
+ if(evt==null)\r
+ {\r
+ if(scrollThread!=null)\r
+ {\r
+ scrollThread.running = false;\r
+ scrollThread = null;\r
+ }\r
+ mouseDragging = false;\r
+ }\r
+ else\r
+ {\r
+ if (scrollThread == null)\r
+ scrollThread = new ScrollThread();\r
+\r
+ mouseDragging = true;\r
+ scrollThread.setEvent(evt);\r
+ }\r
+\r
+ }\r
+\r
// this class allows scrolling off the bottom of the visible alignment\r
class ScrollThread\r
extends Thread\r
this.av = av;\r
}\r
\r
- public void renderGaps(boolean b)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param b DOCUMENT ME!\r
+ */\r
+ public void prepare(Graphics g, boolean renderGaps)\r
{\r
- renderGaps = b;\r
- }\r
+ graphics = g;\r
+ fm = g.getFontMetrics();\r
+\r
+ this.renderGaps = renderGaps;\r
+ }\r
\r
public Color getResidueBoxColour(SequenceI seq, int i)\r
{\r
return resBoxColour;\r
}\r
\r
- public void drawSequence(Graphics g, SequenceI seq, SequenceGroup[] sg,\r
+ public void drawSequence(SequenceI seq, SequenceGroup[] sg,\r
int start, int end, int y1)\r
{\r
allGroups = sg;\r
\r
- graphics = g;\r
-\r
drawBoxes(seq, start, end, y1);\r
\r
if(av.validCharWidth)\r
{\r
- fm = g.getFontMetrics();\r
drawText(seq, start, end, y1);\r
}\r
}\r
return false;\r
}\r
\r
- public void drawHighlightedText(SequenceI seq, int start, int end, int x1,\r
- int y1, int width, int height)\r
+ public void drawHighlightedText(SequenceI seq, int start, int end, int x1, int y1)\r
{\r
- int pady = height / 5;\r
+ int pady = av.charHeight / 5;\r
int charOffset = 0;\r
graphics.setColor(Color.black);\r
- graphics.fillRect(x1, y1, width * (end - start + 1), height);\r
+ graphics.fillRect(x1, y1, av.charWidth * (end - start + 1), av.charHeight);\r
graphics.setColor(Color.white);\r
\r
char s = '~';\r
s = seq.getSequence().charAt(i);\r
}\r
\r
- charOffset = (width - fm.charWidth(s)) / 2;\r
+ charOffset = (av.charWidth - fm.charWidth(s)) / 2;\r
graphics.drawString(String.valueOf(s),\r
- charOffset + x1 + width * (i - start),\r
- y1 + height - pady);\r
+ charOffset + x1 + av.charWidth * (i - start),\r
+ y1 + av.charHeight - pady);\r
}\r
}\r
}\r
\r
}\r
\r
+ void showOriginalData()\r
+ {\r
+ // decide if av alignment is sufficiently different to original data to warrant a new window to be created\r
+ // create new alignmnt window with hidden regions (unhiding hidden regions yields unaligned seqs)\r
+ // or create a selection box around columns in alignment view\r
+ // test Alignment(SeqCigar[])\r
+ Object[] alAndColsel = tree.seqData.getAlignmentAndColumnSelection(av.\r
+ getGapCharacter());\r
+\r
+ if (alAndColsel != null && alAndColsel[0]!=null)\r
+ {\r
+ Alignment al = new Alignment( (SequenceI[]) alAndColsel[0]);\r
+ AlignFrame af = new AlignFrame(al,\r
+ av.applet,\r
+ "Original Data for Tree",\r
+ false);\r
+\r
+ af.viewport.setHiddenColumns( (ColumnSelection) alAndColsel[1] );\r
+ }\r
+ }\r
+\r
class TreeLoader extends Thread\r
{\r
NewickFile newtree;\r
+ jalview.datamodel.AlignmentView odata=null;\r
\r
public TreeLoader(NewickFile newtree)\r
{\r
\r
public void run()\r
{\r
- if (newtree != null)\r
- tree = new NJTree(av.alignment.getSequencesArray(),\r
- newtree);\r
- else\r
+ if(newtree!=null)\r
+ {\r
+ if (odata == null)\r
+ tree = new NJTree(av.alignment.getSequencesArray(),\r
+ newtree);\r
+ else\r
+ tree = new NJTree(av.alignment.getSequencesArray(), odata, newtree);\r
+\r
+ }\r
+ else\r
{\r
int start, end;\r
SequenceI [] seqs;\r
- String[] seqStrings = null;\r
-// if (av.hasHiddenColumns)\r
- // {\r
- // seqStrings = av.getAlignmentView(av.getSelectionGroup()!=null); // av.getSelectionAsString();\r
- // }\r
-\r
+ AlignmentView seqStrings = av.getAlignmentView(av.getSelectionGroup()!=null);\r
if(av.getSelectionGroup()==null)\r
{\r
start = 0;\r
seqs = av.getSelectionGroup().getSequencesInOrder(av.alignment);\r
}\r
\r
- tree = new NJTree(seqs, null, type, pwtype, start, end);\r
+ tree = new NJTree(seqs, seqStrings, type, pwtype, start, end);\r
}\r
\r
tree.reCount(tree.getTopNode());\r
newickOutput_actionPerformed();\r
else if(evt.getSource()==fontSize)\r
fontSize_actionPerformed();\r
+ else if(evt.getSource()==inputData)\r
+ showOriginalData();\r
}\r
\r
public void itemStateChanged(ItemEvent evt)\r
protected CheckboxMenuItem fitToWindow = new CheckboxMenuItem();\r
Menu fileMenu = new Menu();\r
MenuItem newickOutput = new MenuItem();\r
+ MenuItem inputData = new MenuItem();\r
\r
private void jbInit() throws Exception {\r
setLayout(borderLayout1);\r
fileMenu.setLabel("File");\r
newickOutput.setLabel("Newick Format");\r
newickOutput.addActionListener(this);\r
+ inputData.setLabel("Input Data...");\r
\r
add(scrollPane, BorderLayout.CENTER);\r
jMenuBar1.add(fileMenu);\r
jMenu2.add(bootstrapMenu);\r
jMenu2.add(placeholdersMenu);\r
fileMenu.add(newickOutput);\r
+ fileMenu.add(inputData);\r
+ inputData.addActionListener(this);\r
}\r
\r
}\r