}
protected void update() {
alternateStyleSheet = null;
Iterator it = components.iterator();
SVGDocument doc = svgCanvas.getSVGDocument();
while (it.hasNext()) {
JComponent stylesheetMenu = (JComponent)it.next();
stylesheetMenu.removeAll();
stylesheetMenu.setEnabled(false);
ButtonGroup buttonGroup = new ButtonGroup();
for (Node n = doc.getFirstChild();
n != null && n.getNodeType() != n.ELEMENT_NODE;
n = n.getNextSibling()) {
if (n instanceof StyleSheetProcessingInstruction) {
StyleSheetProcessingInstruction sspi;
sspi = (StyleSheetProcessingInstruction)n;
HashTable attrs = sspi.getPseudoAttributes();
final String title = (String)attrs.get("title");
String alt = (String)attrs.get("alternate");
if (title != null && "yes".equals(alt)) {
JRadioButtonMenuItem button;
button = new JRadioButtonMenuItem(title);
button.addActionListener
(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
SVGOMDocument doc;
doc = (SVGOMDocument)svgCanvas.getSVGDocument();
doc.clearViewCSS();
alternateStyleSheet = title;
svgCanvas.setSVGDocument(doc);
}
});