git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Jalview 2.6 source licence
[jalview.git]
/
src
/
jalview
/
appletgui
/
APopupMenu.java
diff --git
a/src/jalview/appletgui/APopupMenu.java
b/src/jalview/appletgui/APopupMenu.java
index
9b21f60
..
f4b3903
100755
(executable)
--- a/
src/jalview/appletgui/APopupMenu.java
+++ b/
src/jalview/appletgui/APopupMenu.java
@@
-1,20
+1,19
@@
/*
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
- * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
+ * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
*
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
+ * This file is part of Jalview.
*
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.appletgui;
*/
package jalview.appletgui;
@@
-79,6
+78,8
@@
public class APopupMenu extends java.awt.PopupMenu implements
CheckboxMenuItem showColourText = new CheckboxMenuItem();
CheckboxMenuItem showColourText = new CheckboxMenuItem();
+ CheckboxMenuItem displayNonconserved = new CheckboxMenuItem();
+
Menu editMenu = new Menu("Edit");
MenuItem copy = new MenuItem("Copy (Jalview Only)");
Menu editMenu = new Menu("Edit");
MenuItem copy = new MenuItem("Copy (Jalview Only)");
@@
-150,6
+151,7
@@
public class APopupMenu extends java.awt.PopupMenu implements
showText.setState(sg.getDisplayText());
showColourText.setState(sg.getColourText());
showBoxes.setState(sg.getDisplayBoxes());
showText.setState(sg.getDisplayText());
showColourText.setState(sg.getColourText());
showBoxes.setState(sg.getDisplayBoxes());
+ displayNonconserved.setState(sg.getShowNonconserved());
if (!ap.av.alignment.getGroups().contains(sg))
{
groupMenu.remove(unGroupMenuItem);
if (!ap.av.alignment.getGroups().contains(sg))
{
groupMenu.remove(unGroupMenuItem);
@@
-176,7
+178,7
@@
public class APopupMenu extends java.awt.PopupMenu implements
continue;
}
final String target = urlLink.getTarget(); // link.substring(0,
continue;
}
final String target = urlLink.getTarget(); // link.substring(0,
- // link.indexOf("|"));
+ // link.indexOf("|"));
final String label = urlLink.getLabel();
if (urlLink.isDynamic())
{
final String label = urlLink.getLabel();
if (urlLink.isDynamic())
{
@@
-188,7
+190,7
@@
public class APopupMenu extends java.awt.PopupMenu implements
// collect id string too
String id = seq.getName();
String descr = seq.getDescription();
// collect id string too
String id = seq.getName();
String descr = seq.getDescription();
- if (descr!=null && descr.length()<1)
+ if (descr != null && descr.length() < 1)
{
descr = null;
}
{
descr = null;
}
@@
-227,8
+229,9
@@
public class APopupMenu extends java.awt.PopupMenu implements
}
// addshowLink(linkMenu, target, url_pref + id + url_suff);
}
}
// addshowLink(linkMenu, target, url_pref + id + url_suff);
}
- // Now construct URLs from description but only try to do it for regex URL links
- if (descr != null && urlLink.getRegexReplace()!=null)
+ // Now construct URLs from description but only try to do it for regex
+ // URL links
+ if (descr != null && urlLink.getRegexReplace() != null)
{
// create link for this URL from description only if regex matches
String[] urls = urlLink.makeUrls(descr, true);
{
// create link for this URL from description only if regex matches
String[] urls = urlLink.makeUrls(descr, true);
@@
-249,11
+252,12
@@
public class APopupMenu extends java.awt.PopupMenu implements
* final String url;
*
* if (link.indexOf("$SEQUENCE_ID$") > -1) { // Substitute SEQUENCE_ID
* final String url;
*
* if (link.indexOf("$SEQUENCE_ID$") > -1) { // Substitute SEQUENCE_ID
- * string and any matching database reference accessions String url_pref =
- * link.substring(link.indexOf("|") + 1, link.indexOf("$SEQUENCE_ID$"));
+ * string and any matching database reference accessions String url_pref
+ * = link.substring(link.indexOf("|") + 1,
+ * link.indexOf("$SEQUENCE_ID$"));
*
* String url_suff = link.substring(link.indexOf("$SEQUENCE_ID$") + 13);
*
* String url_suff = link.substring(link.indexOf("$SEQUENCE_ID$") + 13);
- * // collect matching db-refs DBRefEntry[] dbr =
+ * // collect matching db-refs DBRefEntry[] dbr =
* jalview.util.DBRefUtils.selectRefs(seq.getDBRef(), new
* String[]{target}); // collect id string too String id =
* seq.getName(); if (id.indexOf("|") > -1) { id =
* jalview.util.DBRefUtils.selectRefs(seq.getDBRef(), new
* String[]{target}); // collect id string too String id =
* seq.getName(); if (id.indexOf("|") > -1) { id =
@@
-268,16
+272,19
@@
public class APopupMenu extends java.awt.PopupMenu implements
* link.substring(link.lastIndexOf("|")+1)); }
*/
}
* link.substring(link.lastIndexOf("|")+1)); }
*/
}
-
- if (seq != null)
- {
- seqMenu.add(linkMenu);
- }
- else
+ if (linkMenu.getItemCount() > 0)
{
{
- add(linkMenu);
+ if (seq != null)
+ {
+ seqMenu.add(linkMenu);
+ }
+ else
+ {
+ add(linkMenu);
+ }
}
}
}
}
+ // TODO: add group link menu entry here
if (seq != null)
{
seqMenu.setLabel(seq.getName());
if (seq != null)
{
seqMenu.setLabel(seq.getName());
@@
-298,10
+305,10
@@
public class APopupMenu extends java.awt.PopupMenu implements
* add a show URL menu item to the given linkMenu
*
* @param linkMenu
* add a show URL menu item to the given linkMenu
*
* @param linkMenu
- * @param target -
- * menu label string
- * @param url -
- * url to open
+ * @param target
+ * - menu label string
+ * @param url
+ * - url to open
*/
private void addshowLink(Menu linkMenu, final String target,
final String url)
*/
private void addshowLink(Menu linkMenu, final String target,
final String url)
@@
-313,12
+320,12
@@
public class APopupMenu extends java.awt.PopupMenu implements
* add a show URL menu item to the given linkMenu
*
* @param linkMenu
* add a show URL menu item to the given linkMenu
*
* @param linkMenu
- * @param target -
- * URL target window
- * @param label -
- * menu label string
- * @param url -
- * url to open
+ * @param target
+ * - URL target window
+ * @param label
+ * - menu label string
+ * @param url
+ * - url to open
*/
private void addshowLink(Menu linkMenu, final String target,
final String label, final String url)
*/
private void addshowLink(Menu linkMenu, final String target,
final String label, final String url)
@@
-352,6
+359,10
@@
public class APopupMenu extends java.awt.PopupMenu implements
{
showBoxes_itemStateChanged();
}
{
showBoxes_itemStateChanged();
}
+ else if (evt.getSource() == displayNonconserved)
+ {
+ this.showNonconserved_itemStateChanged();
+ }
}
public void actionPerformed(ActionEvent evt)
}
public void actionPerformed(ActionEvent evt)
@@
-575,18
+586,28
@@
public class APopupMenu extends java.awt.PopupMenu implements
return;
}
return;
}
- int gSize = sg.getSize();
- SequenceI[] seqs = new SequenceI[gSize];
- SequenceFeature[] features = new SequenceFeature[gSize];
+ int rsize = 0, gSize = sg.getSize();
+ SequenceI[] rseqs, seqs = new SequenceI[gSize];
+ SequenceFeature[] tfeatures, features = new SequenceFeature[gSize];
for (int i = 0; i < gSize; i++)
{
for (int i = 0; i < gSize; i++)
{
- seqs[i] = sg.getSequenceAt(i);
int start = sg.getSequenceAt(i).findPosition(sg.getStartRes());
int end = sg.findEndRes(sg.getSequenceAt(i));
int start = sg.getSequenceAt(i).findPosition(sg.getStartRes());
int end = sg.findEndRes(sg.getSequenceAt(i));
- features[i] = new SequenceFeature(null, null, null, start, end,
- "Jalview");
+ if (start <= end)
+ {
+ seqs[rsize] = sg.getSequenceAt(i);
+ features[rsize] = new SequenceFeature(null, null, null, start,
+ end, "Jalview");
+ rsize++;
+ }
}
}
+ rseqs = new SequenceI[rsize];
+ tfeatures = new SequenceFeature[rsize];
+ System.arraycopy(seqs, 0, rseqs, 0, rsize);
+ System.arraycopy(features, 0, tfeatures, 0, rsize);
+ features = tfeatures;
+ seqs = rseqs;
if (ap.seqPanel.seqCanvas.getFeatureRenderer().amendFeatures(seqs,
features, true, ap))
if (ap.seqPanel.seqCanvas.getFeatureRenderer().amendFeatures(seqs,
features, true, ap))
@@
-677,7
+698,9
@@
public class APopupMenu extends java.awt.PopupMenu implements
showBoxes.setState(true);
showBoxes.addItemListener(this);
sequenceName.addActionListener(this);
showBoxes.setState(true);
showBoxes.addItemListener(this);
sequenceName.addActionListener(this);
-
+ displayNonconserved.setLabel("Show Nonconserved");
+ displayNonconserved.setState(false);
+ displayNonconserved.addItemListener(this);
showText.setLabel("Text");
showText.addItemListener(this);
showColourText.setLabel("Colour Text");
showText.setLabel("Text");
showText.addItemListener(this);
showColourText.setLabel("Colour Text");
@@
-766,6
+789,7
@@
public class APopupMenu extends java.awt.PopupMenu implements
menu1.add(showBoxes);
menu1.add(showText);
menu1.add(showColourText);
menu1.add(showBoxes);
menu1.add(showText);
menu1.add(showColourText);
+ menu1.add(displayNonconserved);
toggleCase.addActionListener(this);
pdb.addActionListener(this);
hideSeqs.addActionListener(this);
toggleCase.addActionListener(this);
pdb.addActionListener(this);
hideSeqs.addActionListener(this);
@@
-966,6
+990,12
@@
public class APopupMenu extends java.awt.PopupMenu implements
refresh();
}
refresh();
}
+ public void showNonconserved_itemStateChanged()
+ {
+ getGroup().setShowNonconserved(this.displayNonconserved.getState());
+ refresh();
+ }
+
public void showBoxes_itemStateChanged()
{
getGroup().setDisplayBoxes(showBoxes.getState());
public void showBoxes_itemStateChanged()
{
getGroup().setDisplayBoxes(showBoxes.getState());