protected CMElementDeclaration getSuitableElement(CMNamedNodeMap nameNodeMap) { CMElementDeclaration result = null; int size = nameNodeMap.getLength(); for (int i = 0; i < size; i++) { CMElementDeclaration candidate = (CMElementDeclaration) nameNodeMap.item(i); if (!visitedCMElementDeclarationList.contains(candidate)) { result = candidate; break; } } return result; }
/** * Returns sorted array of CMAttributeDeclarations. * * @param attributes * */ private CMAttributeDeclaration[] getSortedAttributes(CMNamedNodeMap attributes) { List sorted = new ArrayList(); for (int i = 0; i < attributes.getLength(); i++) { sorted.add(attributes.item(i)); } Collections.sort(sorted, getCMAttributeComparator()); return (CMAttributeDeclaration[]) sorted.toArray(new CMAttributeDeclaration[sorted.size()]); }
public static List getNameList(Element element, String[] filter) { List result = new ArrayList(); CMNamedNodeMap attributes = getElementDeclaredAttributes(element); if (attributes != null) { for (int i = 0, n = attributes.getLength(); i < n; i++) { String name = attributes.item(i).getNodeName(); if (Arrays.asList(filter).contains(name)) result.add(name); } } return result; }
public static Object[] getElementReferedAttributes(Element fNode, String[] filter) { List result = new ArrayList(); CMNamedNodeMap cmnnm = getElementDeclaredAttributes(fNode); for (int i = 0, n = cmnnm.getLength(); i < n; i++) { String name = cmnnm.item(i).getNodeName(); if (Arrays.asList(filter).contains(name)) { result.add(cmnnm.item(i)); } } return result.toArray(new CMNode[result.size()]); }
protected Properties mapToProperties(CMNamedNodeMap map) { Properties p = new Properties(); for (int i = 0; i < map.getLength(); i++) { CMEntityDeclaration decl = (CMEntityDeclaration) map.item(i); p.put(decl.getName(), decl.getValue()); } return p; }
protected void addBlockMarkers(CMDocument doc) { if (doc.getElements().getLength() > 0) { Iterator elements = doc.getElements().iterator(); CMNode node = null; while (elements.hasNext()) { node = (CMNode) elements.next(); getBlockMarkers().add(new BlockMarker(node.getNodeName(), null, DOMJSPRegionContexts.JSP_CONTENT, true)); } } }
protected void generateAttributes(CMElementDeclaration elementDecl, StringBuffer buffer) { CMNamedNodeMap attributes = elementDecl.getAttributes(); if (attributes == null) { return; } for (int i = 0; i < attributes.getLength(); i++) { generateAttribute((CMAttributeDeclaration) attributes.item(i), buffer); } return; }
protected boolean requiresAttributes(CMElementDeclaration ed) { CMNamedNodeMap attributes = ed.getAttributes(); if (attributes == null) { return false; } for (int i = 0; i < attributes.getLength(); i++) { if (((CMAttributeDeclaration) attributes.item(i)).getUsage() == CMAttributeDeclaration.REQUIRED) { return true; } } return false; } }
public void visitCMDocument(CMDocument document) { CMNamedNodeMap map = document.getElements(); int size = map.getLength(); for (int i = 0; i < size; i++) { visitCMNode(map.item(i)); } }
public void visitCMDocument(CMDocument document) { CMNamedNodeMap map = document.getElements(); int size = map.getLength(); for (int i = 0; i < size; i++) { visitCMNode(map.item(i)); } }
private static void loadFromCMDocument(TaglibPaletteDrawer category, CMDocument cmdoc) { CMNamedNodeMap nodeMap = cmdoc.getElements(); for (int i = 0, size = nodeMap.getLength(); i < size; i++) { CMElementDeclaration eledecl = (CMElementDeclaration) nodeMap .item(i); String tagName = eledecl.getElementName(); TagToolPaletteEntry item; if (tagName.equalsIgnoreCase(IHTMLConstants.TAG_INPUT)) {//TODO: fix this nonsense! StringBuffer name = new StringBuffer(category.getURI()); name.append(":").append(tagName).append(":").append(tagName); item = category.getTagPaletteEntryById(name.toString()); } else { item = category.getTagPaletteEntryByTagName(tagName); } if (item == null) { createTagEntry(category, eledecl); } } }
public void visitCMAnyElement(CMAnyElement anyElement) { String uri = anyElement.getNamespaceURI(); List list = getCMDocumentList(rootElement, rootElementDeclaration, uri); for (Iterator iterator = list.iterator(); iterator.hasNext(); ) { CMDocument cmdocument = (CMDocument)iterator.next(); if (cmdocument != null) { CMNamedNodeMap map = cmdocument.getElements(); int size = map.getLength(); for (int i = 0; i < size; i++) { CMNode ed = map.item(i); addToTable(childNodeTable,ed); } } } }
public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append("\n\t " + super.toString()); //$NON-NLS-1$ buffer.append("\n\t name:" + StringUtils.escape(getNodeName())); //$NON-NLS-1$ buffer.append("\n\t tag class:" + StringUtils.escape(getTagclass())); //$NON-NLS-1$ buffer.append("\n\t tei class:" + StringUtils.escape(getTeiclass())); //$NON-NLS-1$ buffer.append("\n\t body content:" + StringUtils.escape(getBodycontent())); //$NON-NLS-1$ buffer.append("\n\t description (info):" + StringUtils.escape(getDescription())); //$NON-NLS-1$ buffer.append("\n\t attributes:"); //$NON-NLS-1$ CMNamedNodeMap attributes = getAttributes(); for (int i = 0; i < attributes.getLength(); i++) { buffer.append("\n\t\t" + StringUtils.replace(attributes.item(i).toString(), "\n", "\n\t\t")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } buffer.append("\n\t variables:"); //$NON-NLS-1$ for (int i = 0; i < getVariables().size(); i++) { buffer.append("\n\t\t" + StringUtils.replace(getVariables().get(i).toString(), "\n", "\n\t\t")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } return buffer.toString(); }
protected void addBlockMarkers(String prefix, CMDocument doc) { if (doc.getElements().getLength() > 0) { Iterator elements = doc.getElements().iterator(); CMNode node = null; while (elements.hasNext()) { node = (CMNode) elements.next(); if (node instanceof TLDElementDeclaration && ((TLDElementDeclaration) node).getBodycontent().equals(JSP12TLDNames.CONTENT_TAGDEPENDENT)) getBlockMarkers().add(new BlockMarker(prefix + node.getNodeName(), null, DOMRegionContext.BLOCK_TEXT, true)); else getBlockMarkers().add(new BlockMarker(prefix + node.getNodeName(), null, DOMJSPRegionContexts.JSP_CONTENT, true)); } } }
public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append(super.toString()); buffer.append("\n\t short name:" + StringUtils.escape(getShortname())); //$NON-NLS-1$ buffer.append("\n\t display name:" + StringUtils.escape(getDisplayName())); //$NON-NLS-1$ buffer.append("\n\t description (info):" + StringUtils.escape(getDescription())); //$NON-NLS-1$ buffer.append("\n\t URI:" + StringUtils.escape(getUri())); //$NON-NLS-1$ buffer.append("\n\t jsp version:" + StringUtils.escape(getJspversion())); //$NON-NLS-1$ buffer.append("\n\t taglib version:" + StringUtils.escape(getTlibversion())); //$NON-NLS-1$ buffer.append("\n\t small icon:" + StringUtils.escape(getSmallIcon())); //$NON-NLS-1$ buffer.append("\n\t large icon:" + StringUtils.escape(getLargeIcon())); //$NON-NLS-1$ if (getValidator() != null) buffer.append("\n\t validator:" + StringUtils.replace(getValidator().toString(), "\n", "\n\t\t")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ buffer.append("\n\t listeners:"); //$NON-NLS-1$ for (int i = 0; i < getListeners().size(); i++) { buffer.append("\n" + StringUtils.replace(getListeners().get(i).toString(), "\n", "\n\t\t")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } buffer.append("\n\t elements:"); //$NON-NLS-1$ CMNamedNodeMap elements = getElements(); for (int i = 0; i < elements.getLength(); i++) { buffer.append(StringUtils.replace(elements.item(i).toString(), "\n", "\n\t\t")); //$NON-NLS-1$ //$NON-NLS-2$ } return buffer.toString(); }
for (int i = 0; i < elements.getLength(); i++) { TLDElementDeclaration ed = (TLDElementDeclaration) elements.item(i); if (ed.getBodycontent() == JSP12TLDNames.CONTENT_TAGDEPENDENT)
public void visitCMElementDeclaration(CMElementDeclaration ed) { CMNamedNodeMap nodeMap = ed.getAttributes(); int size = nodeMap.getLength(); for (int i = 0; i < size; i++) { visitCMNode(nodeMap.item(i)); } visitCMNode(ed.getContent()); visitCMDataType(ed.getDataType()); } }
/** * getElements method * @return CMNamedNodeMap * * Returns CMNamedNodeMap of ElementDeclaration */ public CMNamedNodeMap getElements() { if (fElements == null) { int length = getDocument().getElements().getLength(); CMNamedNodeMapImpl elements = new CMNamedNodeMapImpl(); for (int i = 0; i < length; i++) { CMElementDeclaration ed = new CMElementDeclarationWrapperImpl(fPrefix, (CMElementDeclaration) getDocument().getElements().item(i)); elements.setNamedItem(ed.getNodeName(), ed); } fElements = elements; } return fElements; }
return; // cannot validate. CMNamedNodeMap prohibited = (CMNamedNodeMap) dec.getProperty(HTMLCMProperties.PROHIBITED_ANCESTORS); if (prohibited.getLength() <= 0) return; // no prohibited ancestors.