</p>
<p>Selecting this option causes the colour scheme to be applied to
only those residues that occur in that column more than a certain
- percentage of the time. For instance selecting the threshold to be
- 100 will only colour those columns with 100 % identity. This
- threshold option can be applied to the Zappo, Taylor, Hydrophobicity
- and User colour schemes.</p>
+ percentage of the time. For instance, selecting the threshold to be
+ 100 will only colour those columns with 100% identity.</p>
+ <p>To be coloured, a residue must match the consensus (most commonly occurring) residue for the column (or joint equal consensus).</p>
+ <p>The percentage calculation may include or exclude gaps in the column, depending on the option selected for the <a href="../calculations/consensus.html">consensus calculation</a>.</p>
+ <p>With a threshold of 0, colouring is unchanged (including non-consensus residues).</p>
</body>
</html>
// only need to check links if there is one with a
// SEQUENCE_ID which is not the default EMBL_EBI link
ListIterator<String> li = links.listIterator();
- Boolean check = false;
- while (li.hasNext() && !check)
+ boolean check = false;
+ List<JLabel> urls = new ArrayList<JLabel>();
+ while (li.hasNext())
{
String link = li.next();
- check = (link.contains(SEQUENCE_ID) && !link
- .equals(EMBLEBI_STRING));
+ if (link.contains(SEQUENCE_ID) && !link.equals(EMBLEBI_STRING))
+ {
+ check = true;
+ int barPos = link.indexOf("|");
+ String urlMsg = barPos == -1 ? link : link.substring(0,
+ barPos) + ": " + link.substring(barPos + 1);
+ urls.add(new JLabel(urlMsg));
+ }
}
if (!check)
{
MessageManager
.getString("label.SEQUENCE_ID_for_DB_ACCESSION2"));
msgPanel.add(msg);
+ for (JLabel url : urls)
+ {
+ msgPanel.add(url);
+ }
msgPanel.add(msg2);
final JCheckBox jcb = new JCheckBox(
@Override
public void actionPerformed(ActionEvent e)
{
- // update Cache settings if checkbox is selected
- if (jcb.isSelected())
- {
- Cache.setProperty("CHECKURLLINKS", "false");
- }
- else
- {
- Cache.setProperty("CHECKURLLINKS", "true");
- }
+ // update Cache settings for "don't show this again"
+ boolean showWarningAgain = !jcb.isSelected();
+ Cache.setProperty("CHECKURLLINKS",
+ Boolean.valueOf(showWarningAgain).toString());
}
});
msgPanel.add(jcb);
*/
package jalview.gui;
-import static jalview.util.UrlConstants.EMBLEBI_STRING;
import static jalview.util.UrlConstants.DB_ACCESSION;
+import static jalview.util.UrlConstants.EMBLEBI_STRING;
import static jalview.util.UrlConstants.SEQUENCE_ID;
import static jalview.util.UrlConstants.SRS_STRING;
else
{
Cache.applicationProperties.remove("SEQUENCE_LINKS");
+ sequenceURLLinks.clear();
}
Cache.applicationProperties.setProperty("USE_PROXY",
}
});
urlTB.setFont(JvSwingUtils.getLabelFont());
- urlTB.setText("http://www.");
+ urlTB.setText("http://");
urlTB.setBounds(new Rectangle(78, 40, 309, 23));
urlTB.addKeyListener(new KeyAdapter()
{
*/
public class Platform
{
+ private static Boolean isAMac = null;
+
+ private static Boolean isHeadless = null;
+
/**
* sorry folks - Macs really are different
*
*/
public static boolean isAMac()
{
- return java.lang.System.getProperty("os.name").indexOf("Mac") > -1;
+ if (isAMac == null)
+ {
+ isAMac = System.getProperty("os.name").indexOf("Mac") > -1;
+ }
+ return isAMac.booleanValue();
}
public static boolean isHeadless()
{
- String hdls = java.lang.System.getProperty("java.awt.headless");
-
- return hdls != null && hdls.equals("true");
+ if (isHeadless == null)
+ {
+ isHeadless = "true".equals(System.getProperty("java.awt.headless"));
+ }
+ return isHeadless;
}
/**
*/
public static boolean isControlDown(MouseEvent e)
{
- if (isAMac())
+ boolean aMac = isAMac();
+ return isControlDown(e, aMac);
+ }
+
+ /**
+ * Overloaded version of method (to allow unit testing)
+ *
+ * @param e
+ * @param aMac
+ * @return
+ */
+ protected static boolean isControlDown(MouseEvent e, boolean aMac)
+ {
+ if (aMac)
{
/*
* answer false for right mouse button
*/
public class TestHtsContigDb
{
- @Test
+ @Test(groups = "Functional")
public final void testHTSReferenceSequence() throws Exception
{
HtsContigDb remmadb = new HtsContigDb("REEMADB", new File(
public class AlignFrameTest
{
- @Test
+ @Test(groups = "Functional")
public void testHideFeatureColumns()
{
SequenceI seq1 = new Sequence("Seq1", "ABCDEFGHIJ");
public class AppVarnaTest
{
- @Test
+ @Test(groups = "Functional")
public void testReplaceOddGaps()
{
String struct = "{(<]}>)";
public class PfamFormatInputTest
{
- @Test
+ @Test(groups = "Functional")
public void testPfamFormatNoLimits() throws IOException
{
- AlignmentI al = new jalview.io.AppletFormatAdapter().readFile("ASEQ"
+ AlignmentI al = new AppletFormatAdapter().readFile("ASEQ"
+ '\t' + "...--FFAFAFF--", AppletFormatAdapter.PASTE, "PFAM");
Assert.assertEquals(1, al.getHeight(), "Wrong number of sequences");
Assert.assertTrue(al.hasValidSequence(),
"Didn't extract limits from PFAM ID");
}
- @Test
+ @Test(groups = "Functional")
public void testPfamFormatValidLimits() throws IOException
{
- AlignmentI al = new jalview.io.AppletFormatAdapter().readFile(
+ AlignmentI al = new AppletFormatAdapter().readFile(
"ASEQ/15-25" + '\t' + "...--FFAFAFF--",
AppletFormatAdapter.PASTE, "PFAM");
Assert.assertEquals(1, al.getHeight(), "Wrong number of sequences");
--- /dev/null
+package jalview.util;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.awt.Button;
+import java.awt.Event;
+import java.awt.event.MouseEvent;
+
+import org.testng.annotations.Test;
+
+public class PlatformTest
+{
+ Button b = new Button();
+
+ /**
+ * isControlDown for Mac should answer true for Meta-down, but not for right
+ * mouse (popup trigger)
+ */
+ @Test(groups = "Functional")
+ public void testIsControlDown_mac()
+ {
+ int clickCount = 1;
+ boolean isPopupTrigger = false;
+ int buttonNo = MouseEvent.BUTTON1;
+ boolean mac = true;
+
+ int mods = 0;
+ // not concerned with MouseEvent id, when, x, y, xAbs, yAbs values
+ assertFalse(Platform.isControlDown(new MouseEvent(b, 0, 0L, mods, 0, 0,
+ 0, 0, clickCount, isPopupTrigger, buttonNo), mac));
+
+ mods = Event.CTRL_MASK;
+ assertFalse(Platform.isControlDown(new MouseEvent(b, 0, 0L, mods, 0, 0,
+ 0, 0, clickCount, isPopupTrigger, buttonNo), mac));
+
+ mods = Event.META_MASK;
+ assertTrue(Platform.isControlDown(new MouseEvent(b, 0, 0L, mods, 0, 0,
+ 0, 0, clickCount, isPopupTrigger, buttonNo), mac));
+
+ isPopupTrigger = true;
+ assertFalse(Platform.isControlDown(new MouseEvent(b, 0, 0L, mods, 0, 0,
+ 0, 0, clickCount, isPopupTrigger, buttonNo), mac));
+
+ isPopupTrigger = false;
+ buttonNo = MouseEvent.BUTTON2;
+ mods = 0;
+ assertFalse(Platform.isControlDown(new MouseEvent(b, 0, 0L, mods, 0, 0,
+ 0, 0, clickCount, isPopupTrigger, buttonNo), mac));
+ }
+
+ /**
+ * If not a Mac, we only care whether CTRL_MASK modifier is set on the mouse
+ * event
+ */
+ @Test(groups = "Functional")
+ public void testIsControlDown_notMac()
+ {
+ int clickCount = 1;
+ boolean isPopupTrigger = false;
+ int buttonNo = MouseEvent.BUTTON1;
+ boolean mac = false;
+
+ int mods = 0;
+ // not concerned with MouseEvent id, when, x, y, xAbs, yAbs values
+ assertFalse(Platform.isControlDown(new MouseEvent(b, 0, 0L, mods, 0, 0,
+ 0, 0, clickCount, isPopupTrigger, buttonNo), mac));
+
+ mods = Event.CTRL_MASK;
+ assertTrue(Platform.isControlDown(new MouseEvent(b, 0, 0L, mods, 0, 0,
+ 0, 0, clickCount, isPopupTrigger, buttonNo), mac));
+
+ mods = Event.CTRL_MASK | Event.SHIFT_MASK | Event.ALT_MASK;
+ clickCount = 2;
+ buttonNo = 2;
+ isPopupTrigger = true;
+ assertTrue(Platform.isControlDown(new MouseEvent(b, 0, 0L, mods, 0, 0,
+ 0, 0, clickCount, isPopupTrigger, buttonNo), mac));
+ }
+}
{
orig_alig.deleteAnnotation(aa);
}
- testAnnotationFileIO("Testing IUPred Annotation IO", orig_alig);
+ checkAnnotationFileIO("Testing IUPred Annotation IO", orig_alig);
}
- public static void testAnnotationFileIO(String testname, AlignmentI al)
+ static void checkAnnotationFileIO(String testname, AlignmentI al)
{
try
{