public class VEmbedded extends HTML implements Paintable {
public static final String CLICK_EVENT_IDENTIFIER = "click";
+ public static final String ALTERNATE_TEXT = "alt";
private static String CLASSNAME = "v-embedded";
}
DOM.setElementProperty(el, "src", getSrc(uidl, client));
+ if (uidl.hasAttribute(ALTERNATE_TEXT)) {
+ el.setPropertyString(ALTERNATE_TEXT,
+ uidl.getStringAttribute(ALTERNATE_TEXT));
+ }
+
if (created) {
// insert in dom late
getElement().appendChild(el);
// Handle embedding of Flash
addStyleName(CLASSNAME + "-flash");
setHTML(createFlashEmbed(uidl));
-
} else if (mime.equals("image/svg+xml")) {
addStyleName(CLASSNAME + "-svg");
String data;
uidl.getStringAttribute("standby"));
}
getElement().appendChild(obj);
-
+ if (uidl.hasAttribute(ALTERNATE_TEXT)) {
+ obj.setInnerText(uidl.getStringAttribute(ALTERNATE_TEXT));
+ }
} else {
VConsole.log("Unknown Embedded mimetype '" + mime + "'");
}
// End embed tag
html.append("></embed>");
+ if (uidl.hasAttribute(ALTERNATE_TEXT)) {
+ html.append(uidl.getStringAttribute(ALTERNATE_TEXT));
+ }
+
// End object tag
html.append("</object>");
private String archive = null;
+ private String altText;
+
/**
* Creates a new empty Embedded object.
*/
if (archive != null && !"".equals(archive)) {
target.addAttribute("archive", archive);
}
+ if (altText != null && !"".equals(altText)) {
+ target.addAttribute(VEmbedded.ALTERNATE_TEXT, altText);
+ }
// Params
for (final Iterator<String> i = getParameterNames(); i.hasNext();) {
}
}
+ /**
+ * Sets this component's "alt-text", that is, an alternate text that can be
+ * presented instead of this component's normal content, for accessibility
+ * purposes. Does not work when {@link #setType(int)} has been called with
+ * {@link #TYPE_BROWSER}.
+ *
+ * @param altText
+ * A short, human-readable description of this component's
+ * content.
+ * @since 6.8
+ */
+ public void setAlternateText(String altText) {
+ if (altText != this.altText
+ || (altText != null && !altText.equals(this.altText))) {
+ this.altText = altText;
+ requestRepaint();
+ }
+ }
+
+ /**
+ * Gets this component's "alt-text".
+ *
+ * @see #setAlternateText(String)
+ */
+ public String getAlternateText() {
+ return altText;
+ }
+
/**
* Sets an object parameter. Parameters are optional information, and they
* are passed to the instantiated object. Parameters are are stored as name