/* */ private final void buildIDIndex(DOM document) /* */ { /* 322 */ setRootForKeys(document.getDocument()); /* */ /* 324 */ if ((document instanceof DOMEnhancedForDTM)) { /* 325 */ DOMEnhancedForDTM enhancedDOM = (DOMEnhancedForDTM) document; /* */ /* 330 */ if (enhancedDOM.hasDOMSource()) { /* 331 */ buildKeyIndex("##id", document); /* 332 */ return; /* */ } /* */ /* 335 */ Hashtable elementsByID = enhancedDOM.getElementsWithIDs(); /* */ /* 337 */ if (elementsByID == null) { /* 338 */ return; /* */ } /* */ /* 344 */ Enumeration idValues = elementsByID.keys(); /* 345 */ boolean hasIDValues = false; /* */ /* 347 */ while (idValues.hasMoreElements()) { /* 348 */ Object idValue = idValues.nextElement(); /* 349 */ int element = document.getNodeHandle(((Integer) elementsByID.get(idValue)).intValue()); /* */ /* 354 */ buildKeyIndex("##id", element, idValue); /* 355 */ hasIDValues = true; /* */ } /* */ /* 358 */ if (hasIDValues) /* 359 */ setKeyIndexDom("##id", document); /* */ } /* */ }
/** Print the HTML tag. */ public static void printTag(PrintStream out, Hashtable atts) { out.print("<applet"); String v = (String) atts.get("codebase"); if (v != null) { out.print(" codebase=\"" + v + "\""); } v = (String) atts.get("code"); if (v == null) { v = "applet.class"; } out.print(" code=\"" + v + "\""); v = (String) atts.get("width"); if (v == null) { v = "150"; } out.print(" width=" + v); v = (String) atts.get("height"); if (v == null) { v = "100"; } out.print(" height=" + v); v = (String) atts.get("name"); if (v != null) { out.print(" name=\"" + v + "\""); } out.println(">"); // A very slow sorting algorithm int len = atts.size(); String params[] = new String[len]; len = 0; for (Enumeration e = atts.keys(); e.hasMoreElements(); ) { String param = (String) e.nextElement(); int i = 0; for (; i < len; i++) { if (params[i].compareTo(param) >= 0) { break; } } System.arraycopy(params, i, params, i + 1, len - i); params[i] = param; len++; } for (int i = 0; i < len; i++) { String param = params[i]; if (systemParam.get(param) == null) { out.println("<param name=" + param + " value=\"" + atts.get(param) + "\">"); } } out.println("</applet>"); }