/** Is this image within a link? */ boolean isLink() { // ! It would be nice to cache this but in an editor it can change // See if I have an HREF attribute courtesy of the enclosing A tag: AttributeSet anchorAttr = (AttributeSet) fElement.getAttributes().getAttribute(HTML.Tag.A); if (anchorAttr != null) { return anchorAttr.isDefined(HTML.Attribute.HREF); } return false; }
/** Look up an integer-valued attribute. <b>Not</b> recursive. */ private int getIntAttr(HTML.Attribute name, int deflt) { AttributeSet attr = fElement.getAttributes(); if (attr.isDefined(name)) { // does not check parents! int i; String val = (String) attr.getAttribute(name); if (val == null) i = deflt; else try { i = Math.max(0, Integer.parseInt(val)); } catch (NumberFormatException x) { i = deflt; } return i; } else return deflt; }