+ /**
+ * A helper class to parse a string of the possible forms "content"
+ * "[index]content", "[keyName=keyValue]content" and return the integer index,
+ * the strings keyName and keyValue, and the content after the square brackets
+ * (if present). Values not set will be -1 or null.
+ */
+ protected class SubId
+ {
+ protected int index = 0;
+
+ protected String keyName = null;
+
+ protected String keyValue = null;
+
+ protected String content = null;
+
+ protected SubId(String item)
+ {
+ if (item.indexOf('[') == 0 && item.indexOf(']') > 1)
+ {
+ int openBracket = item.indexOf('[');
+ int closeBracket = item.indexOf(']');
+ String indexString = item.substring(openBracket + 1, closeBracket);
+ this.content = item.substring(closeBracket + 1);
+ int equals = indexString.indexOf('=');
+ if (equals > -1)
+ {
+ this.keyName = indexString.substring(0, equals);
+ this.keyValue = indexString.substring(equals + 1);
+ this.index = -1;
+ }
+ else
+ {
+ try
+ {
+ this.index = Integer.parseInt(indexString);
+ } catch (NumberFormatException e)
+ {
+ Console.warn("Failed to obtain sequenced id or index from '"
+ + item + "'. Setting index=0 and using content='"
+ + content + "'.");
+ }
+ }
+ }
+ else
+ {
+ this.content = item;
+ }
+ }
+ }
+
+ private void testMethod()
+ {
+ Desktop Jalview = Desktop.instance;
+ jalview.bin.Cache.setProperty("SVG_RENDERING", "Text");
+ for (AlignFrame af : Jalview.getAlignFrames())
+ {
+ String title = af.getTitle();
+ System.out.println("Title: " + af.getTitle());
+ AlignViewport view = af.getCurrentView();
+ view.setShowText(false);
+ view.setShowAnnotation(false);
+ af.deselectAllSequenceMenuItem_actionPerformed(null);
+ af.repaint();
+ af.createPNG(new File(title + ".png"));
+ af.createSVG(new File(title + ".svg"));
+ }
+ }