- return lastp=p;
- }
-
- /**
- * appends the features at rpos to the given stringbuffer ready for display in
- * a tooltip
- *
- * @param tooltipText2
- * @param linkImageURL
- * @param rpos
- * @param features
- * TODO refactor to Jalview 'utilities' somehow.
- */
- public void appendFeatures(StringBuffer tooltipText2,
- String linkImageURL, int rpos, SequenceFeature[] features)
- {
- appendFeatures(tooltipText2,linkImageURL,rpos,features,null);
- }
- public void appendFeatures(StringBuffer tooltipText2, String string,
- int rpos, SequenceFeature[] features, Hashtable minmax)
- {
- String tmpString;
- if (features != null)
- {
- for (int i = 0; i < features.length; i++)
- {
- if (features[i].getType().equals("disulfide bond"))
- {
- if (features[i].getBegin() == rpos
- || features[i].getEnd() == rpos)
- {
- if (tooltipText2.length() > 6)
- {
- tooltipText2.append("<br>");
- }
- tooltipText2.append("disulfide bond " + features[i].getBegin()
- + ":" + features[i].getEnd());
- if (features[i].links != null)
- {
- tooltipText2.append(" <img src=\"" + linkImageURL + "\">");
- }
- }
- }
- else
- {
- if (tooltipText2.length() > 6)
- {
- tooltipText2.append("<br>");
- }
- // TODO: remove this hack to display link only features
- boolean linkOnly = features[i].getValue("linkonly") != null;
- if (!linkOnly)
- {
- tooltipText2.append(features[i].getType() + " ");
- if (rpos != 0)
- {
- // we are marking a positional feature
- tooltipText2.append(features[i].begin);
- }
- if (features[i].begin != features[i].end)
- {
- tooltipText2.append(" " + features[i].end);
- }
-
- if (features[i].getDescription() != null
- && !features[i].description.equals(features[i]
- .getType()))
- {
- tmpString = features[i].getDescription();
- int startTag = tmpString.toUpperCase().indexOf("<HTML>");
- if (startTag > -1)
- {
- tmpString = tmpString.substring(startTag + 6);
- }
- int endTag = tmpString.toUpperCase().indexOf("</BODY>");
- if (endTag > -1)
- {
- tmpString = tmpString.substring(0, endTag);
- }
- endTag = tmpString.toUpperCase().indexOf("</HTML>");
- if (endTag > -1)
- {
- tmpString = tmpString.substring(0, endTag);
- }
-
- if (startTag > -1)
- {
- tooltipText2.append("; " + tmpString);
- }
- else
- {
- if (tmpString.indexOf("<") > -1
- || tmpString.indexOf(">") > -1)
- {
- // The description does not specify html is to
- // be used, so we must remove < > symbols
- tmpString = tmpString.replaceAll("<", "<");
- tmpString = tmpString.replaceAll(">", ">");
-
- tooltipText2.append("; ");
- tooltipText2.append(tmpString);
-
- }
- else
- {
- tooltipText2.append("; " + tmpString);
- }
- }
- }
- // check score should be shown
- if (features[i].getScore() != Float.NaN) {
- float[][] rng=(minmax==null) ? null : ((float[][])minmax.get(features[i].getType()));
- if (rng!=null && rng[0]!=null && rng[0][0]!=rng[0][1]) {
- tooltipText2.append(" Score=" + features[i].getScore());
- }
- }
- if (features[i].getValue("status") != null)
- {
- String status = features[i].getValue("status").toString();
- if (status.length() > 0)
- {
- tooltipText2.append("; (" + features[i].getValue("status")
- + ")");
- }
- }
- }
- if (features[i].links != null)
- {
- tooltipText2.append(" <img src=\"" + linkImageURL + "\">");
- }
-
- }
- }
- }